@@ -769,7 +769,7 @@ def _results_message_to_execute_response(self, resp, operation_state):
769769 arrow_schema_bytes = schema_bytes ,
770770 )
771771
772- def get_execution_result (self , op_handle ):
772+ def get_execution_result (self , op_handle , cursor ):
773773
774774 assert op_handle is not None
775775
@@ -780,15 +780,15 @@ def get_execution_result(self, op_handle):
780780 False ,
781781 op_handle .modifiedRowCount ,
782782 ),
783- maxRows = max_rows ,
784- maxBytes = max_bytes ,
783+ maxRows = cursor . arraysize ,
784+ maxBytes = cursor . buffer_size_bytes ,
785785 orientation = ttypes .TFetchOrientation .FETCH_NEXT ,
786786 includeResultSetMetadata = True ,
787787 )
788788
789789 resp = self .make_request (self ._client .FetchResults , req )
790790
791- t_result_set_metadata_resp = resp .resultSetMetaData
791+ t_result_set_metadata_resp = resp .resultSetMetadata
792792
793793 lz4_compressed = t_result_set_metadata_resp .lz4Compressed
794794 is_staging_operation = t_result_set_metadata_resp .isStagingOperation
@@ -797,15 +797,12 @@ def get_execution_result(self, op_handle):
797797 t_result_set_metadata_resp .schema
798798 )
799799
800- if pyarrow :
801- schema_bytes = (
802- t_result_set_metadata_resp .arrowSchema
803- or self ._hive_schema_to_arrow_schema (t_result_set_metadata_resp .schema )
804- .serialize ()
805- .to_pybytes ()
806- )
807- else :
808- schema_bytes = None
800+ schema_bytes = (
801+ t_result_set_metadata_resp .arrowSchema
802+ or self ._hive_schema_to_arrow_schema (t_result_set_metadata_resp .schema )
803+ .serialize ()
804+ .to_pybytes ()
805+ )
809806
810807 queue = ResultSetQueueFactory .build_queue (
811808 row_set_type = resp .resultSetMetadata .resultFormat ,
@@ -820,11 +817,11 @@ def get_execution_result(self, op_handle):
820817 return ExecuteResponse (
821818 arrow_queue = queue ,
822819 status = resp .status ,
823- has_been_closed_server_side = has_been_closed_server_side ,
820+ has_been_closed_server_side = False ,
824821 has_more_rows = has_more_rows ,
825822 lz4_compressed = lz4_compressed ,
826823 is_staging_operation = is_staging_operation ,
827- command_handle = resp . operationHandle ,
824+ command_handle = op_handle ,
828825 description = description ,
829826 arrow_schema_bytes = schema_bytes ,
830827 )
@@ -847,9 +844,9 @@ def _wait_until_command_done(self, op_handle, initial_operation_status_resp):
847844 self ._check_command_not_in_error_or_closed_state (op_handle , poll_resp )
848845 return operation_state
849846
850- def get_query_status (self , op_handle ):
847+ def get_query_state (self , op_handle ):
851848 poll_resp = self ._poll_for_status (op_handle )
852- operation_state = poll_resp .status
849+ operation_state = poll_resp .operationState
853850 self ._check_command_not_in_error_or_closed_state (op_handle , poll_resp )
854851 return operation_state
855852
@@ -883,7 +880,7 @@ def execute_command(
883880 cursor ,
884881 use_cloud_fetch = True ,
885882 parameters = [],
886- perform_async = False ,
883+ async_op = False ,
887884 ):
888885 assert session_handle is not None
889886
@@ -914,7 +911,7 @@ def execute_command(
914911 )
915912 resp = self .make_request (self ._client .ExecuteStatement , req )
916913
917- if perform_async :
914+ if async_op :
918915 return self ._handle_execute_response_async (resp , cursor )
919916 else :
920917 return self ._handle_execute_response (resp , cursor )
@@ -1012,7 +1009,7 @@ def _handle_execute_response(self, resp, cursor):
10121009 final_operation_state = self ._wait_until_command_done (
10131010 resp .operationHandle ,
10141011 resp .directResults and resp .directResults .operationStatus ,
1015- )
1012+ )
10161013
10171014 return self ._results_message_to_execute_response (resp , final_operation_state )
10181015
0 commit comments