Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

impala jdbc not support UPSERT preparestatement (KUDU)

impala jdbc not support UPSERT preparestatement (KUDU)

New Contributor

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.

6 REPLIES 6

Re: impala jdbc not support UPSERT preparestatement (KUDU)

Cloudera Employee

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

Re: impala jdbc not support UPSERT preparestatement (KUDU)

New Contributor
hello Matt Jacobs thanks for response, our sqlstatement is like below insert into tablename (id,col1,col2) values(?,?,?) or upsert into tablename (id,col1,col2) values(?,?,?) when using insert is ok, but upsert report exception. for your advise we now trying, late will give you the result thanks

Re: impala jdbc not support UPSERT preparestatement (KUDU)

New Contributor
we try "UseNativeQuery=1" option to the jdbc driver connection string, the result is same as before.

Re: impala jdbc not support UPSERT preparestatement (KUDU)

New Contributor
Hello, i have the same result :( have you find a solution ?

Re: impala jdbc not support UPSERT preparestatement (KUDU)

New Contributor

I have the same problem, is this a bug?

Re: impala jdbc not support UPSERT preparestatement (KUDU)

Community Manager

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


Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.

Learn more about the Cloudera Community:

Terms of Service