Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<version>0.1-SNAPSHOT</version>

<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

Expand Down Expand Up @@ -66,6 +66,12 @@
<artifactId>duckdb_jdbc</artifactId>
<version>0.7.1</version>
</dependency>
<dependency>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move this dependency (as well as duckdb) to different profiles? That way we can enabling packaging the necessary drivers for a certain setup with -P.

<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.2.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.networknt</groupId>
<artifactId>json-schema-validator</artifactId>
Expand Down Expand Up @@ -166,7 +172,8 @@
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>2.36.0</version>
<!-- To support JDK 1.8 -->
<version>2.30.0</version>
<configuration>
<java>
<includes>
Expand All @@ -186,14 +193,16 @@
<file>${project.basedir}/src/main/resources/license-header</file>
</licenseHeader>
</java>
<!--
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove this code?

<json>
<includes>
<include>src/main/resources/**/*.json</include>
</includes>
<jackson>
<version>2.14.2</version>
</jackson>
</json>
</json>
-->
<sql>
<includes>
<include>src/main/resources/**/*.sql</include>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public void execute() throws Exception {
checkResults(executor.invokeAll(threads));
eventInfo = writePhaseEvent(phaseStartTime, phase.getId(), Status.SUCCESS);
} catch (Exception e) {
LOGGER.error("Exception executing phase: " + phase.getId());
LOGGER.error("Exception executing phase: " + phase.getId(), e);
writePhaseEvent(phaseStartTime, phase.getId(), Status.FAILURE);
throw e;
}
Expand All @@ -136,7 +136,7 @@ public void execute() throws Exception {
Status.SUCCESS,
new ObjectMapper().writeValueAsString(experimentMetadata));
} catch (Exception e) {
LOGGER.error("Exception executing experiment: " + config.getId());
LOGGER.error("Exception executing experiment: " + config.getId(), e);
writeExperimentEvent(
repetitionStartTime,
config.getId(),
Expand Down Expand Up @@ -232,14 +232,14 @@ public Boolean call() throws SQLException {
Map<String, Object> values = getRuntimeParameterValues(task);
executeTask(connection, task, values);
} catch (Exception e) {
LOGGER.error("Exception executing task: " + task.getId());
LOGGER.error("Exception executing task: " + task.getId(), e);
writeTaskEvent(taskStartTime, task.getId(), Status.FAILURE);
throw e;
}
writeTaskEvent(taskStartTime, task.getId(), Status.SUCCESS);
}
} catch (Exception e) {
LOGGER.error("Exception executing session: " + session.getId());
LOGGER.error("Exception executing session: " + session.getId(), e);
writeSessionEvent(sessionStartTime, session.getId(), Status.FAILURE);
throw e;
}
Expand All @@ -255,23 +255,24 @@ private void executeTask(Connection connection, TaskExec task, Map<String, Objec
for (StatementExec statement : file.getStatements()) {
Instant statementStartTime = Instant.now();
try (Statement s = connection.createStatement()) {
boolean hasResults =
s.execute(StringUtils.replaceParameters(statement, values).getStatement());
String sqlStr = StringUtils.replaceParameters(statement, values).getStatement();
LOGGER.debug("Executing query: {}", sqlStr);
boolean hasResults = s.execute(sqlStr);
if (hasResults) {
ResultSet rs = s.getResultSet();
while (rs.next()) {
// do nothing
}
}
} catch (Exception e) {
LOGGER.error("Exception executing statement: " + statement.getId());
LOGGER.error("Exception executing statement: " + statement.getId(), e);
writeStatementEvent(statementStartTime, statement.getId(), Status.FAILURE);
throw e;
}
writeStatementEvent(statementStartTime, statement.getId(), Status.SUCCESS);
}
} catch (Exception e) {
LOGGER.error("Exception executing file: " + file.getId());
LOGGER.error("Exception executing file: " + file.getId(), e);
writeFileEvent(fileStartTime, file.getId(), Status.FAILURE);
throw e;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@
import java.sql.SQLException;
import javax.annotation.Nullable;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/** Simple JDBC connection manager. */
public class ConnectionManager {

private static final Logger LOG = LoggerFactory.getLogger(ConnectionManager.class);
private final String url;

@Nullable private final String username;
Expand All @@ -38,6 +41,7 @@ private ConnectionManager(String url, String username, String password) {
}

public Connection createConnection() throws SQLException {
LOG.info("Creating connection: url: {}, username:{}", url, username);
if (StringUtils.isEmpty(username)) {
return DriverManager.getConnection(url);
} else {
Expand All @@ -47,6 +51,7 @@ public Connection createConnection() throws SQLException {

public static ConnectionManager from(ConnectionConfig connectionConfig) {
try {
LOG.info("Loading driver: {}", connectionConfig.getDriver());
Class.forName(connectionConfig.getDriver());
} catch (ClassNotFoundException e) {
throw new IllegalArgumentException(
Expand Down