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.