diff --git a/lib/rbhive/t_c_l_i_connection.rb b/lib/rbhive/t_c_l_i_connection.rb index ab795c5..e1839e9 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, @@ -236,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