1、org.apache.hive.service.cli.HiveSQLException: Invalid OperationHandle: OperationHandle
我使用JDBC 连接的时候有这个报错
org.apache.hive.service.cli.HiveSQLException: Invalid OperationHandle: OperationHandle [opType=EXECUTE_STATEMENT, getHandleIdentifier()=2af76f9e-f1fa-45b7-
8543-45e93b36cf84]
at org.apache.hive.jdbc.Utils.verifySuccess(Utils.java:231)
at org.apache.hive.jdbc.Utils.verifySuccessWithInfo(Utils.java:217)
at org.apache.hive.jdbc.HiveQueryResultSet.next(HiveQueryResultSet.java:365)
at cn.com.bonc.bigdata.sync.hive.HiveSyncTask$1.run(HiveSyncTask.java:185)
后来定位到原因,是因为我使用同一个Statement获取了两个ResultSet,然后出现的问题,我将其改成一个ResultSet使用一个Statement获取就好了。类似代码如下面这种(只截取部分)
try (Connection conn = srcConnInfo.getConnection()) {
resultSet = conn.prepareStatement("show partitions " + table).executeQuery();
while (resultSet.next()) {
***
}
rs = conn.prepareStatement("desc formatted " + table + " partition (" + normalPartition + ")").executeQuery();