@@ -769,7 +769,7 @@ def _results_message_to_execute_response(self, resp, operation_state):
769
769
arrow_schema_bytes = schema_bytes ,
770
770
)
771
771
772
- def get_execution_result (self , op_handle ):
772
+ def get_execution_result (self , op_handle , cursor ):
773
773
774
774
assert op_handle is not None
775
775
@@ -780,15 +780,15 @@ def get_execution_result(self, op_handle):
780
780
False ,
781
781
op_handle .modifiedRowCount ,
782
782
),
783
- maxRows = max_rows ,
784
- maxBytes = max_bytes ,
783
+ maxRows = cursor . arraysize ,
784
+ maxBytes = cursor . buffer_size_bytes ,
785
785
orientation = ttypes .TFetchOrientation .FETCH_NEXT ,
786
786
includeResultSetMetadata = True ,
787
787
)
788
788
789
789
resp = self .make_request (self ._client .FetchResults , req )
790
790
791
- t_result_set_metadata_resp = resp .resultSetMetaData
791
+ t_result_set_metadata_resp = resp .resultSetMetadata
792
792
793
793
lz4_compressed = t_result_set_metadata_resp .lz4Compressed
794
794
is_staging_operation = t_result_set_metadata_resp .isStagingOperation
@@ -797,15 +797,12 @@ def get_execution_result(self, op_handle):
797
797
t_result_set_metadata_resp .schema
798
798
)
799
799
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
+ )
809
806
810
807
queue = ResultSetQueueFactory .build_queue (
811
808
row_set_type = resp .resultSetMetadata .resultFormat ,
@@ -820,11 +817,11 @@ def get_execution_result(self, op_handle):
820
817
return ExecuteResponse (
821
818
arrow_queue = queue ,
822
819
status = resp .status ,
823
- has_been_closed_server_side = has_been_closed_server_side ,
820
+ has_been_closed_server_side = False ,
824
821
has_more_rows = has_more_rows ,
825
822
lz4_compressed = lz4_compressed ,
826
823
is_staging_operation = is_staging_operation ,
827
- command_handle = resp . operationHandle ,
824
+ command_handle = op_handle ,
828
825
description = description ,
829
826
arrow_schema_bytes = schema_bytes ,
830
827
)
@@ -847,9 +844,9 @@ def _wait_until_command_done(self, op_handle, initial_operation_status_resp):
847
844
self ._check_command_not_in_error_or_closed_state (op_handle , poll_resp )
848
845
return operation_state
849
846
850
- def get_query_status (self , op_handle ):
847
+ def get_query_state (self , op_handle ):
851
848
poll_resp = self ._poll_for_status (op_handle )
852
- operation_state = poll_resp .status
849
+ operation_state = poll_resp .operationState
853
850
self ._check_command_not_in_error_or_closed_state (op_handle , poll_resp )
854
851
return operation_state
855
852
@@ -883,7 +880,7 @@ def execute_command(
883
880
cursor ,
884
881
use_cloud_fetch = True ,
885
882
parameters = [],
886
- perform_async = False ,
883
+ async_op = False ,
887
884
):
888
885
assert session_handle is not None
889
886
@@ -914,7 +911,7 @@ def execute_command(
914
911
)
915
912
resp = self .make_request (self ._client .ExecuteStatement , req )
916
913
917
- if perform_async :
914
+ if async_op :
918
915
return self ._handle_execute_response_async (resp , cursor )
919
916
else :
920
917
return self ._handle_execute_response (resp , cursor )
@@ -1012,7 +1009,7 @@ def _handle_execute_response(self, resp, cursor):
1012
1009
final_operation_state = self ._wait_until_command_done (
1013
1010
resp .operationHandle ,
1014
1011
resp .directResults and resp .directResults .operationStatus ,
1015
- )
1012
+ )
1016
1013
1017
1014
return self ._results_message_to_execute_response (resp , final_operation_state )
1018
1015
0 commit comments