def test_get_exec_summary(self): execute_statement_req = TCLIService.TExecuteStatementReq() execute_statement_req.sessionHandle = self.session_handle execute_statement_req.statement = "SELECT COUNT(1) FROM functional.alltypes" execute_statement_resp = self.hs2_client.ExecuteStatement( execute_statement_req) TestHS2.check_response(execute_statement_resp) exec_summary_req = ImpalaHiveServer2Service.TGetExecSummaryReq() exec_summary_req.operationHandle = execute_statement_resp.operationHandle exec_summary_req.sessionHandle = self.session_handle exec_summary_resp = self.hs2_client.GetExecSummary(exec_summary_req) # GetExecSummary() only works for closed queries TestHS2.check_response(exec_summary_resp, TCLIService.TStatusCode.ERROR_STATUS) close_operation_req = TCLIService.TCloseOperationReq() close_operation_req.operationHandle = execute_statement_resp.operationHandle TestHS2.check_response( self.hs2_client.CloseOperation(close_operation_req)) exec_summary_resp = self.hs2_client.GetExecSummary(exec_summary_req) TestHS2.check_response(exec_summary_resp) assert len(exec_summary_resp.summary.nodes) > 0
def test_get_profile(self): execute_statement_req = TCLIService.TExecuteStatementReq() execute_statement_req.sessionHandle = self.session_handle execute_statement_req.statement = "SELECT COUNT(2) FROM functional.alltypes" execute_statement_resp = self.hs2_client.ExecuteStatement( execute_statement_req) TestHS2.check_response(execute_statement_resp) get_profile_req = ImpalaHiveServer2Service.TGetRuntimeProfileReq() get_profile_req.operationHandle = execute_statement_resp.operationHandle get_profile_req.sessionHandle = self.session_handle get_profile_resp = self.hs2_client.GetRuntimeProfile(get_profile_req) TestHS2.check_response(get_profile_resp) assert execute_statement_req.statement in get_profile_resp.profile close_operation_req = TCLIService.TCloseOperationReq() close_operation_req.operationHandle = execute_statement_resp.operationHandle TestHS2.check_response( self.hs2_client.CloseOperation(close_operation_req)) get_profile_resp = self.hs2_client.GetRuntimeProfile(get_profile_req) TestHS2.check_response(get_profile_resp) assert execute_statement_req.statement in get_profile_resp.profile
def close(self, op_handle): close_op_req = TCLIService.TCloseOperationReq() close_op_req.operationHandle = op_handle close_op_resp = self.hs2_client.CloseOperation(close_op_req) assert close_op_resp.status.statusCode == TCLIService.TStatusCode.SUCCESS_STATUS