@@ -1050,6 +1050,64 @@ def test_handle_execute_response_reads_has_more_rows_in_direct_results(
10501050
10511051 self .assertEqual (has_more_rows , has_more_rows_resp )
10521052
1053+ @patch (
1054+ "databricks.sql.utils.ResultSetQueueFactory.build_queue" , return_value = Mock ()
1055+ )
1056+ @patch ("databricks.sql.backend.thrift_backend.TCLIService.Client" , autospec = True )
1057+ def test_handle_execute_response_reads_has_more_rows_in_result_response (
1058+ self , tcli_service_class , build_queue
1059+ ):
1060+ for has_more_rows , resp_type in itertools .product (
1061+ [True , False ], self .execute_response_types
1062+ ):
1063+ with self .subTest (has_more_rows = has_more_rows , resp_type = resp_type ):
1064+ tcli_service_instance = tcli_service_class .return_value
1065+ results_mock = MagicMock ()
1066+ results_mock .startRowOffset = 0
1067+
1068+ execute_resp = resp_type (
1069+ status = self .okay_status ,
1070+ directResults = None ,
1071+ operationHandle = self .operation_handle ,
1072+ )
1073+
1074+ fetch_results_resp = ttypes .TFetchResultsResp (
1075+ status = self .okay_status ,
1076+ hasMoreRows = has_more_rows ,
1077+ results = results_mock ,
1078+ resultSetMetadata = ttypes .TGetResultSetMetadataResp (
1079+ resultFormat = ttypes .TSparkRowSetType .ARROW_BASED_SET
1080+ ),
1081+ )
1082+
1083+ operation_status_resp = ttypes .TGetOperationStatusResp (
1084+ status = self .okay_status ,
1085+ operationState = ttypes .TOperationState .FINISHED_STATE ,
1086+ errorMessage = "some information about the error" ,
1087+ )
1088+
1089+ tcli_service_instance .FetchResults .return_value = fetch_results_resp
1090+ tcli_service_instance .GetOperationStatus .return_value = (
1091+ operation_status_resp
1092+ )
1093+ tcli_service_instance .GetResultSetMetadata .return_value = (
1094+ self .metadata_resp
1095+ )
1096+ thrift_backend = self ._create_thrift_client ()
1097+
1098+ thrift_backend ._handle_execute_response (execute_resp , Mock ())
1099+ _ , has_more_rows_resp = thrift_backend .fetch_results (
1100+ command_id = Mock (),
1101+ max_rows = 1 ,
1102+ max_bytes = 1 ,
1103+ expected_row_start_offset = 0 ,
1104+ lz4_compressed = False ,
1105+ arrow_schema_bytes = Mock (),
1106+ description = Mock (),
1107+ )
1108+
1109+ self .assertEqual (has_more_rows , has_more_rows_resp )
1110+
10531111 @patch ("databricks.sql.backend.thrift_backend.TCLIService.Client" , autospec = True )
10541112 def test_arrow_batches_row_count_are_respected (self , tcli_service_class ):
10551113 # make some semi-real arrow batches and check the number of rows is correct in the queue
0 commit comments