@@ -49,32 +49,26 @@ def _filter_sea_result_set(
49
49
Returns:
50
50
A filtered SEA result set
51
51
"""
52
- # Get all remaining rows
53
- original_index = result_set .results .cur_row_index
54
- result_set .results .cur_row_index = 0 # Reset to beginning
52
+ # Get all remaining rows from the current position (JDBC-aligned behavior)
53
+ # Note: This will only filter rows that haven't been read yet
55
54
all_rows = result_set .results .remaining_rows ()
56
55
57
56
# Filter rows
58
57
filtered_rows = [row for row in all_rows if filter_func (row )]
59
58
60
- # Import SeaResultSet here to avoid circular imports
61
- from databricks .sql .result_set import SeaResultSet
62
-
63
- # Reuse the command_id from the original result set
64
- command_id = result_set .command_id
65
-
66
- # Create an ExecuteResponse with the filtered data
67
59
execute_response = ExecuteResponse (
68
- command_id = command_id ,
60
+ command_id = result_set . command_id ,
69
61
status = result_set .status ,
70
62
description = result_set .description ,
71
- has_more_rows = result_set ._has_more_rows ,
63
+ has_more_rows = result_set .has_more_rows ,
72
64
results_queue = JsonQueue (filtered_rows ),
73
65
has_been_closed_server_side = result_set .has_been_closed_server_side ,
74
66
lz4_compressed = False ,
75
67
is_staging_operation = False ,
76
68
)
77
69
70
+ from databricks .sql .result_set import SeaResultSet
71
+
78
72
return SeaResultSet (
79
73
connection = result_set .connection ,
80
74
execute_response = execute_response ,
0 commit comments