[ https://issues.apache.org/jira/browse/HIVE-4617?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15217491#comment-15217491 ]
Amruth S commented on HIVE-4617: -------------------------------- Hi, I am trying to asynchronously run queries in hive. Essentially I want to - Initiate an execution and get an operation handle. - Persist the operation handle elsewhere. - De-serialize the handle, poll for status and results. Lets say there is a process P1 which initiates a query asynchronously. Ideally if the operation handle is shared, any other process should be able to poll for status and results. This *does not not happen if I use the binary thrift protocol (tcp)*. As soon as the process which initiated the asynchronous request disconnects, the operation handle in hive server seem to get cleaned up. (deleteContext gets called which in turn closes the session) @Override public void deleteContext(ServerContext serverContext, TProtocol input, TProtocol output) { Metrics metrics = MetricsFactory.getInstance(); if (metrics != null) { try { metrics.decrementCounter(MetricsConstant.OPEN_CONNECTIONS); } catch (Exception e) { LOG.warn("Error Reporting JDO operation to Metrics system", e); } } ThriftCLIServerContext context = (ThriftCLIServerContext) serverContext; SessionHandle sessionHandle = context.getSessionHandle(); if (sessionHandle != null) { LOG.info("Session disconnected without closing properly, close it now"); try { cliService.closeSession(sessionHandle); } catch (HiveSQLException e) { LOG.warn("Failed to close session: " + e, e); } } } But if I use the HTTP thrift transport mode, this does not happen and I am able to accomplish my use-case successfully. Ideally shouldn't the working and functionality be irrespective of the underlying transport mode (?) > Asynchronous execution in HiveServer2 to run a query in non-blocking mode > ------------------------------------------------------------------------- > > Key: HIVE-4617 > URL: https://issues.apache.org/jira/browse/HIVE-4617 > Project: Hive > Issue Type: Improvement > Components: HiveServer2 > Affects Versions: 0.12.0 > Reporter: Jaideep Dhok > Assignee: Vaibhav Gumashta > Fix For: 0.12.0 > > Attachments: HIVE-4617.D12417.1.patch, HIVE-4617.D12417.2.patch, > HIVE-4617.D12417.3.patch, HIVE-4617.D12417.4.patch, HIVE-4617.D12417.5.patch, > HIVE-4617.D12417.6.patch, HIVE-4617.D12507.1.patch, HIVE-4617.D12507.2.patch, > HIVE-4617.D12507.3.patch, HIVE-4617.D12507.4.patch, HIVE-4617.D12507.5.patch, > HIVE-4617.D12507.6.patch, HIVE-4617.D12507Test.1.patch, > HIVE-4617.D12783.1.patch > > > Provide a way to run a queries asynchronously. Current executeStatement call > blocks until the query run is complete. -- This message was sent by Atlassian JIRA (v6.3.4#6332)