Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
2.1.1
-
None
-
None
Description
Migrating from CDH 5.16 (Hive 1.1.0+) to CDH 6.3 (Hive 2.1.1+) introduced a regression in the the JDBC driver.
It was detected in a "agnostic" jdbc handling service which works for several DBMS including Teradata, Impala, and the former Hive driver.
java.sql.Statement JDBC Interface method :
/** * Retrieves the current result as an update count; * if the result is a <code>ResultSet</code> object or there are no more results, -1 * is returned. This method should be called only once per result. * * @return the current result as an update count; -1 if the current result is a * <code>ResultSet</code> object or there are no more results * @exception SQLException if a database access error occurs or * this method is called on a closed <code>Statement</code> * @see #execute */ int getUpdateCount() throws SQLException;
Does not return -1 when it should, it rather throws :
Caused by: java.sql.SQLException: org.apache.thrift.protocol.TProtocolException: Required field 'operationHandle' is unset! Struct:TGetOperationStatusReq(operationHandle:null) at org.apache.hive.jdbc.HiveStatement.waitForOperationToComplete(HiveStatement.java:395) at org.apache.hive.jdbc.HiveStatement.getUpdateCount(HiveStatement.java:688) ... 30 more Caused by: org.apache.thrift.protocol.TProtocolException: Required field 'operationHandle' is unset! Struct:TGetOperationStatusReq(operationHandle:null) at org.apache.hive.service.rpc.thrift.TGetOperationStatusReq.validate(TGetOperationStatusReq.java:294) at org.apache.hive.service.rpc.thrift.TCLIService$GetOperationStatus_args.validate(TCLIService.java:12587) at org.apache.hive.service.rpc.thrift.TCLIService$GetOperationStatus_args$GetOperationStatus_argsStandardScheme.write(TCLIService.java:12644) at org.apache.hive.service.rpc.thrift.TCLIService$GetOperationStatus_args$GetOperationStatus_argsStandardScheme.write(TCLIService.java:12613) at org.apache.hive.service.rpc.thrift.TCLIService$GetOperationStatus_args.write(TCLIService.java:12564) at org.apache.thrift.TServiceClient.sendBase(TServiceClient.java:71) at org.apache.thrift.TServiceClient.sendBase(TServiceClient.java:62) at org.apache.hive.service.rpc.thrift.TCLIService$Client.send_GetOperationStatus(TCLIService.java:461) at org.apache.hive.service.rpc.thrift.TCLIService$Client.GetOperationStatus(TCLIService.java:453) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.hive.jdbc.HiveConnection$SynchronizedHandler.invoke(HiveConnection.java:1415) at com.sun.proxy.$Proxy20.GetOperationStatus(Unknown Source) at org.apache.hive.jdbc.HiveStatement.waitForOperationToComplete(HiveStatement.java:364) ... 33 more
And method:
/** * Moves to this <code>Statement</code> object's next result, returns * <code>true</code> if it is a <code>ResultSet</code> object, and * implicitly closes any current <code>ResultSet</code> * object(s) obtained with the method <code>getResultSet</code>. * * <P>There are no more results when the following is true: * <PRE>{@code * // stmt is a Statement object * ((stmt.getMoreResults() == false) && (stmt.getUpdateCount() == -1)) * }</PRE> * * @return <code>true</code> if the next result is a <code>ResultSet</code> * object; <code>false</code> if it is an update count or there are * no more results * @exception SQLException if a database access error occurs or * this method is called on a closed <code>Statement</code> * @see #execute */ boolean getMoreResults() throws SQLException;
Always returns true if the statement is not a result set whereas false is expected.