Arnaud Linz created HIVE-23105: ---------------------------------- Summary: HiveServer2 regression breaks getUpdateCount / getMoreResult API contract Key: HIVE-23105 URL: https://issues.apache.org/jira/browse/HIVE-23105 Project: Hive Issue Type: Bug Components: JDBC Affects Versions: 2.1.1 Reporter: Arnaud Linz
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. Statement JDBC Method : {code:java} /** * 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; {code} Does not return -1 when it should it rather throws : {code:java} 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 {code} And method: {code:java} /** * 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; {code} Always returns true if the statement is not a result set whereas false is expected (especially since the javadoc's ((stmt.getMoreResults() == false) && (stmt.getUpdateCount() == -1)) throws an Exception...) -- This message was sent by Atlassian Jira (v8.3.4#803005)