Skip to content

Commit 60ef67f

Browse files
pavgrawivern
authored andcommitted
Upgrade Impala driver to 2.6 (using JDBC 4.2) (#1340)
* Use released version of standardized-analysis-utils * Increase WebAPI version to 2.7.4 * Upgrade Impala driver to 2.6 (using JDBC 4.2) * Fixes batch mode
1 parent c99563e commit 60ef67f

File tree

4 files changed

+18
-130
lines changed

4 files changed

+18
-130
lines changed

pom.xml

+8-127
Original file line numberDiff line numberDiff line change
@@ -903,50 +903,15 @@
903903
<id>webapi-impala</id>
904904
<properties>
905905
<impala.enabled>true</impala.enabled>
906-
<!-- Impala JDBC driver path -->
907-
<impala.classpath>...path/to/impala/jdbc/drivers...</impala.classpath>
906+
<impala.driver.version>2.6.15</impala.driver.version>
907+
<!-- Impala JDBC driver path -->
908+
<impala.classpath>...path/to/impala/jdbc/drivers...</impala.classpath>
908909
</properties>
909910
<dependencies>
910-
<dependency>
911-
<groupId>hive</groupId>
912-
<artifactId>hive_metastore</artifactId>
913-
<version>1.0.0</version>
914-
</dependency>
915-
<dependency>
916-
<groupId>hive</groupId>
917-
<artifactId>hive_service</artifactId>
918-
<version>1.0.0</version>
919-
</dependency>
920911
<dependency>
921912
<groupId>com.cloudera</groupId>
922-
<artifactId>ImpalaJDBC41</artifactId>
923-
<version>2.5.43</version>
924-
</dependency>
925-
<dependency>
926-
<groupId>libfb</groupId>
927-
<artifactId>libfb303</artifactId>
928-
<version>0.9.0</version>
929-
</dependency>
930-
<dependency>
931-
<groupId>libthrift</groupId>
932-
<artifactId>libthrift</artifactId>
933-
<version>0.9.0</version>
934-
</dependency>
935-
<dependency>
936-
<groupId>ql</groupId>
937-
<artifactId>ql</artifactId>
938-
<version>1.0.0</version>
939-
</dependency>
940-
<dependency>
941-
<groupId>TCLI</groupId>
942-
<artifactId>TCLI</artifactId>
943-
<version>1.0.0</version>
944-
</dependency>
945-
<dependency>
946-
<groupId>org.apache.zookeeper</groupId>
947-
<artifactId>zookeeper</artifactId>
948-
<version>3.4.6</version>
949-
<type>pom</type>
913+
<artifactId>ImpalaJDBC42</artifactId>
914+
<version>${impala.driver.version}</version>
950915
</dependency>
951916
</dependencies>
952917
<build>
@@ -964,94 +929,10 @@
964929
</goals>
965930
<configuration>
966931
<groupId>com.cloudera</groupId>
967-
<artifactId>ImpalaJDBC41</artifactId>
968-
<version>2.5.43</version>
969-
<packaging>jar</packaging>
970-
<file>${impala.classpath}/ImpalaJDBC41.jar</file>
971-
</configuration>
972-
</execution>
973-
<execution>
974-
<id>hive_metastore</id>
975-
<phase>initialize</phase>
976-
<goals>
977-
<goal>install-file</goal>
978-
</goals>
979-
<configuration>
980-
<groupId>hive</groupId>
981-
<artifactId>hive_metastore</artifactId>
982-
<version>1.0.0</version>
983-
<packaging>jar</packaging>
984-
<file>${impala.classpath}/hive_metastore.jar</file>
985-
</configuration>
986-
</execution>
987-
<execution>
988-
<id>hive_service</id>
989-
<phase>initialize</phase>
990-
<goals>
991-
<goal>install-file</goal>
992-
</goals>
993-
<configuration>
994-
<groupId>hive</groupId>
995-
<artifactId>hive_service</artifactId>
996-
<version>1.0.0</version>
997-
<packaging>jar</packaging>
998-
<file>${impala.classpath}/hive_service.jar</file>
999-
</configuration>
1000-
</execution>
1001-
<execution>
1002-
<id>libfb</id>
1003-
<phase>initialize</phase>
1004-
<goals>
1005-
<goal>install-file</goal>
1006-
</goals>
1007-
<configuration>
1008-
<groupId>libfb</groupId>
1009-
<artifactId>libfb303</artifactId>
1010-
<version>0.9.0</version>
1011-
<packaging>jar</packaging>
1012-
<file>${impala.classpath}/libfb303-0.9.0.jar</file>
1013-
</configuration>
1014-
</execution>
1015-
<execution>
1016-
<id>libthrift</id>
1017-
<phase>initialize</phase>
1018-
<goals>
1019-
<goal>install-file</goal>
1020-
</goals>
1021-
<configuration>
1022-
<groupId>libthrift</groupId>
1023-
<artifactId>libthrift</artifactId>
1024-
<version>0.9.0</version>
1025-
<packaging>jar</packaging>
1026-
<file>${impala.classpath}/libthrift-0.9.0.jar</file>
1027-
</configuration>
1028-
</execution>
1029-
<execution>
1030-
<id>ql</id>
1031-
<phase>initialize</phase>
1032-
<goals>
1033-
<goal>install-file</goal>
1034-
</goals>
1035-
<configuration>
1036-
<groupId>ql</groupId>
1037-
<artifactId>ql</artifactId>
1038-
<version>1.0.0</version>
1039-
<packaging>jar</packaging>
1040-
<file>${impala.classpath}/ql.jar</file>
1041-
</configuration>
1042-
</execution>
1043-
<execution>
1044-
<id>TCLI</id>
1045-
<phase>initialize</phase>
1046-
<goals>
1047-
<goal>install-file</goal>
1048-
</goals>
1049-
<configuration>
1050-
<groupId>TCLI</groupId>
1051-
<artifactId>TCLI</artifactId>
1052-
<version>1.0.0</version>
932+
<artifactId>ImpalaJDBC42</artifactId>
933+
<version>${impala.driver.version}</version>
1053934
<packaging>jar</packaging>
1054-
<file>${impala.classpath}/TCLIServiceClient.jar</file>
935+
<file>${impala.classpath}/ImpalaJDBC42.jar</file>
1055936
</configuration>
1056937
</execution>
1057938
</executions>

src/main/extras/impala/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
To build WebAPI with Impala support do the following:
2-
1. Go to the https://www.cloudera.com/downloads/connectors/impala/jdbc/2-5-43.html
2+
1. Go to the https://www.cloudera.com/downloads/connectors/impala/jdbc/2-6-15.html
33
2. Register to clouder if you did not registered earlier or sign in to your Cloudera account
44
3. Download the latest Impala JDBC drivers
55
4. Unpack archive and and set the impala.classpath property in your settings.xml to the unpacked archive location (ie: C://downloads/impalaJDBC) inside the webapi-impala profile.

src/main/java/org/ohdsi/webapi/DataAccessConfig.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public DataSource primaryDataSource() {
7777
//note autocommit defaults vary across vendors. use provided @Autowired TransactionTemplate
7878

7979
String[] supportedDrivers;
80-
supportedDrivers = new String[]{"org.postgresql.Driver", "com.microsoft.sqlserver.jdbc.SQLServerDriver", "oracle.jdbc.driver.OracleDriver", "com.amazon.redshift.jdbc.Driver", "com.cloudera.impala.jdbc41.Driver", "net.starschema.clouddb.jdbc.BQDriver", "org.netezza.Driver", "com.simba.googlebigquery.jdbc42.Driver"};
80+
supportedDrivers = new String[]{"org.postgresql.Driver", "com.microsoft.sqlserver.jdbc.SQLServerDriver", "oracle.jdbc.driver.OracleDriver", "com.amazon.redshift.jdbc.Driver", "com.cloudera.impala.jdbc.Driver", "net.starschema.clouddb.jdbc.BQDriver", "org.netezza.Driver", "com.simba.googlebigquery.jdbc42.Driver"};
8181
for (String driverName : supportedDrivers) {
8282
try {
8383
Class.forName(driverName);

src/main/java/org/ohdsi/webapi/util/CancelableJdbcTemplate.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class BatchUpdateStatementCallback implements StatementCallback<int[]>, SqlProvi
4848
public int[] doInStatement(Statement stmt) throws SQLException, DataAccessException {
4949
int[] rowsAffected = new int[sql.length];
5050
cancelOp.setStatement(stmt);
51-
if (JdbcUtils.supportsBatchUpdates(stmt.getConnection())) {
51+
if (supportsBatchUpdates(stmt.getConnection())) {
5252
for (String sqlStmt : sql) {
5353
this.currSql = appendSql(this.currSql, sqlStmt);
5454
stmt.addBatch(sqlStmt);
@@ -135,4 +135,11 @@ private String getSql(PreparedStatementCreator statement) {
135135

136136
return execute(new BatchUpdateConnectionCallback());
137137
}
138+
139+
private boolean supportsBatchUpdates(Connection connection) throws SQLException {
140+
141+
// NOTE:
142+
// com.cloudera.impala.hivecommon.dataengine.HiveJDBCDataEngine.prepareBatch throws NOT_IMPLEMENTED exception
143+
return JdbcUtils.supportsBatchUpdates(connection) && !connection.getMetaData().getURL().startsWith("jdbc:impala");
144+
}
138145
}

0 commit comments

Comments
 (0)