Skip to content

Commit dee47f7

Browse files
filters stuff (align with JDBC)
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parent 4cb15fd commit dee47f7

File tree

2 files changed

+6
-15
lines changed

2 files changed

+6
-15
lines changed

src/databricks/sql/backend/filters.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,32 +49,26 @@ def _filter_sea_result_set(
4949
Returns:
5050
A filtered SEA result set
5151
"""
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
5554
all_rows = result_set.results.remaining_rows()
5655

5756
# Filter rows
5857
filtered_rows = [row for row in all_rows if filter_func(row)]
5958

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
6759
execute_response = ExecuteResponse(
68-
command_id=command_id,
60+
command_id=result_set.command_id,
6961
status=result_set.status,
7062
description=result_set.description,
71-
has_more_rows=result_set._has_more_rows,
63+
has_more_rows=result_set.has_more_rows,
7264
results_queue=JsonQueue(filtered_rows),
7365
has_been_closed_server_side=result_set.has_been_closed_server_side,
7466
lz4_compressed=False,
7567
is_staging_operation=False,
7668
)
7769

70+
from databricks.sql.result_set import SeaResultSet
71+
7872
return SeaResultSet(
7973
connection=result_set.connection,
8074
execute_response=execute_response,

src/databricks/sql/backend/sea/backend.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,6 @@ def _filter_session_configuration(
6666
class SeaDatabricksClient(DatabricksClient):
6767
"""
6868
Statement Execution API (SEA) implementation of the DatabricksClient interface.
69-
70-
This implementation provides session management functionality for SEA,
71-
while other operations raise NotImplementedError.
7269
"""
7370

7471
# SEA API paths

0 commit comments

Comments
 (0)