@@ -758,6 +758,12 @@ def _results_message_to_execute_response(self, resp, operation_state):
758758 direct_results = resp .directResults
759759 has_been_closed_server_side = direct_results and direct_results .closeOperation
760760
761+ has_more_rows = (
762+ (not direct_results )
763+ or (not direct_results .resultSet )
764+ or direct_results .resultSet .hasMoreRows
765+ )
766+
761767 description = self ._hive_schema_to_description (
762768 t_result_set_metadata_resp .schema
763769 )
@@ -779,7 +785,7 @@ def _results_message_to_execute_response(self, resp, operation_state):
779785 if status is None :
780786 raise ValueError (f"Unknown command state: { operation_state } " )
781787
782- return ExecuteResponse (
788+ execute_response = ExecuteResponse (
783789 command_id = command_id ,
784790 status = status ,
785791 description = description ,
@@ -790,6 +796,8 @@ def _results_message_to_execute_response(self, resp, operation_state):
790796 result_format = t_result_set_metadata_resp .resultFormat ,
791797 )
792798
799+ return execute_response , has_more_rows
800+
793801 def get_execution_result (
794802 self , command_id : CommandId , cursor : "Cursor"
795803 ) -> "ResultSet" :
@@ -855,6 +863,7 @@ def get_execution_result(
855863 t_row_set = resp .results ,
856864 max_download_threads = self .max_download_threads ,
857865 ssl_options = self ._ssl_options ,
866+ has_more_rows = has_more_rows ,
858867 )
859868
860869 def _wait_until_command_done (self , op_handle , initial_operation_status_resp ):
@@ -967,7 +976,9 @@ def execute_command(
967976 self ._handle_execute_response_async (resp , cursor )
968977 return None
969978 else :
970- execute_response = self ._handle_execute_response (resp , cursor )
979+ execute_response , has_more_rows = self ._handle_execute_response (
980+ resp , cursor
981+ )
971982
972983 t_row_set = None
973984 if resp .directResults and resp .directResults .resultSet :
@@ -983,6 +994,7 @@ def execute_command(
983994 t_row_set = t_row_set ,
984995 max_download_threads = self .max_download_threads ,
985996 ssl_options = self ._ssl_options ,
997+ has_more_rows = has_more_rows ,
986998 )
987999
9881000 def get_catalogs (
@@ -1004,7 +1016,7 @@ def get_catalogs(
10041016 )
10051017 resp = self .make_request (self ._client .GetCatalogs , req )
10061018
1007- execute_response = self ._handle_execute_response (resp , cursor )
1019+ execute_response , has_more_rows = self ._handle_execute_response (resp , cursor )
10081020
10091021 t_row_set = None
10101022 if resp .directResults and resp .directResults .resultSet :
@@ -1020,6 +1032,7 @@ def get_catalogs(
10201032 t_row_set = t_row_set ,
10211033 max_download_threads = self .max_download_threads ,
10221034 ssl_options = self ._ssl_options ,
1035+ has_more_rows = has_more_rows ,
10231036 )
10241037
10251038 def get_schemas (
@@ -1045,7 +1058,7 @@ def get_schemas(
10451058 )
10461059 resp = self .make_request (self ._client .GetSchemas , req )
10471060
1048- execute_response = self ._handle_execute_response (resp , cursor )
1061+ execute_response , has_more_rows = self ._handle_execute_response (resp , cursor )
10491062
10501063 t_row_set = None
10511064 if resp .directResults and resp .directResults .resultSet :
@@ -1061,6 +1074,7 @@ def get_schemas(
10611074 t_row_set = t_row_set ,
10621075 max_download_threads = self .max_download_threads ,
10631076 ssl_options = self ._ssl_options ,
1077+ has_more_rows = has_more_rows ,
10641078 )
10651079
10661080 def get_tables (
@@ -1090,7 +1104,7 @@ def get_tables(
10901104 )
10911105 resp = self .make_request (self ._client .GetTables , req )
10921106
1093- execute_response = self ._handle_execute_response (resp , cursor )
1107+ execute_response , has_more_rows = self ._handle_execute_response (resp , cursor )
10941108
10951109 t_row_set = None
10961110 if resp .directResults and resp .directResults .resultSet :
@@ -1106,6 +1120,7 @@ def get_tables(
11061120 t_row_set = t_row_set ,
11071121 max_download_threads = self .max_download_threads ,
11081122 ssl_options = self ._ssl_options ,
1123+ has_more_rows = has_more_rows ,
11091124 )
11101125
11111126 def get_columns (
@@ -1135,7 +1150,7 @@ def get_columns(
11351150 )
11361151 resp = self .make_request (self ._client .GetColumns , req )
11371152
1138- execute_response = self ._handle_execute_response (resp , cursor )
1153+ execute_response , has_more_rows = self ._handle_execute_response (resp , cursor )
11391154
11401155 t_row_set = None
11411156 if resp .directResults and resp .directResults .resultSet :
@@ -1151,6 +1166,7 @@ def get_columns(
11511166 t_row_set = t_row_set ,
11521167 max_download_threads = self .max_download_threads ,
11531168 ssl_options = self ._ssl_options ,
1169+ has_more_rows = has_more_rows ,
11541170 )
11551171
11561172 def _handle_execute_response (self , resp , cursor ):
0 commit comments