From fcf3b271c4e923a5a1d2e4d6f1a7ec6e0558773c Mon Sep 17 00:00:00 2001 From: Hikaru Ojima Date: Fri, 20 Nov 2015 16:18:26 +0900 Subject: [PATCH 1/2] raise error when async_execute failed. --- lib/rbhive/t_c_l_i_connection.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/rbhive/t_c_l_i_connection.rb b/lib/rbhive/t_c_l_i_connection.rb index ab795c5..4116542 100644 --- a/lib/rbhive/t_c_l_i_connection.rb +++ b/lib/rbhive/t_c_l_i_connection.rb @@ -192,14 +192,16 @@ def set(name,value) # Async execute def async_execute(query) @logger.info("Executing query asynchronously: #{query}") - op_handle = @client.ExecuteStatement( + exec_result = @client.ExecuteStatement( Hive2::Thrift::TExecuteStatementReq.new( sessionHandle: @session.sessionHandle, statement: query, runAsync: true ) - ).operationHandle - + ) + raise_error_if_failed!(exec_result) + op_handle = exec_result.operationHandle + # Return handles to get hold of this query / session again { session: @session.sessionHandle, From c5d7ec521ac56b365df3e7563c84dc784e611244 Mon Sep 17 00:00:00 2001 From: Hikaru Ojima Date: Fri, 20 Nov 2015 16:45:08 +0900 Subject: [PATCH 2/2] remove print debug --- lib/rbhive/t_c_l_i_connection.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rbhive/t_c_l_i_connection.rb b/lib/rbhive/t_c_l_i_connection.rb index 4116542..e1839e9 100644 --- a/lib/rbhive/t_c_l_i_connection.rb +++ b/lib/rbhive/t_c_l_i_connection.rb @@ -238,7 +238,7 @@ def async_state(handles) response = @client.GetOperationStatus( Hive2::Thrift::TGetOperationStatusReq.new(operationHandle: prepare_operation_handle(handles)) ) - puts response.operationState + case response.operationState when Hive2::Thrift::TOperationState::FINISHED_STATE return :finished