Created on 05-03-2017 10:21 PM - edited 09-16-2022 04:33 AM
impala jdbc not support UPSERT preparestatement (KUDU)
JDBC version is impala_jdbc_2.5.37.1057
code is like below:
conn.setAutoCommit(false);
PreparedStatement pstmt = conn.prepareStatement(sqlStatement);
for (ArrayList<String> ss : list) {
for (int i=0;i<types.length;i++) {
String s = "NULL";
if (i < ss.size()) s = ss.get(i);
setDataValue(i+1, pstmt, types[i], s);
}
pstmt.addBatch();
}
pstmt.executeBatch();
pstmt.close();
conn.setAutoCommit(true);
when the sqlStatement is using INSERT it's ok, but when using UPSERT, it report below exceptions
Exception in thread "main" java.sql.SQLException: [Simba][ImpalaJDBCDriver](500057) Multi-batch parameter values not supported for this query type.
at com.cloudera.hivecommon.dataengine.HiveJDBCNativeQueryExecutor.getQueryWithParametersPopulated(Unknown Source)
at com.cloudera.hivecommon.dataengine.HiveJDBCNativeQueryExecutor.execute(Unknown Source)
at com.cloudera.jdbc.common.SPreparedStatement.executeBatch(Unknown Source)
at com.seahigh.util.ImpalaJdbcUtil.batchInsert2_0(ImpalaJdbcUtil.java:391)
at com.seahigh.util.TestKuduInsertUtil.batchInsertTable(TestKuduInsertUtil.java:180)
at com.seahigh.util.TestKuduInsertUtil.testInsert(TestKuduInsertUtil.java:59)
Caused by: com.cloudera.support.exceptions.GeneralException: [Simba][ImpalaJDBCDriver](500057) Multi-batch parameter values not supported for this query type.
Created 05-04-2017 03:11 PM
Hi,
Two questions:
1) What query are you trying to execute?
2) Can you try adding the "UseNativeQuery=1" option to the jdbc driver connection string? (see http://www.cloudera.com/documentation/other/connectors/impala-jdbc/latest/Cloudera-JDBC-Driver-for-I... for details)
Thanks
Created 05-07-2017 08:06 PM
Created 05-07-2017 08:08 PM
Created 09-03-2018 08:04 AM
Created on 03-12-2019 04:21 AM - edited 03-12-2019 04:22 AM
I have the same problem, is this a bug?
Created 03-12-2019 02:55 PM
As upsert is not SQL-92 syntax, the Impala JDBC driver does not currently support it. However, we are currently testing a newer version of JDBC driver and hope to support upsert in the near future. For the time being, please break these statements into a combination of insert and update statements.
Robert Justice, Technical Resolution Manager