Skip to content

Commit 0ae2ab0

Browse files
Revert "merge"
This reverts commit c0bf461, reversing changes made to 75505cf.
1 parent 97d65d3 commit 0ae2ab0

File tree

7 files changed

+86
-775
lines changed

7 files changed

+86
-775
lines changed

examples/experimental/sea_connector_test.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
import subprocess
1111
from typing import List, Tuple
1212

13-
# Configure logging
14-
logging.basicConfig(level=logging.INFO)
13+
logging.basicConfig(level=logging.DEBUG)
1514
logger = logging.getLogger(__name__)
1615

1716
TEST_MODULES = [

src/databricks/sql/backend/filters.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
TYPE_CHECKING,
1818
)
1919

20+
from databricks.sql.utils import JsonQueue, SeaResultSetQueueFactory
2021
from databricks.sql.backend.types import ExecuteResponse, CommandId
2122
from databricks.sql.backend.sea.models.base import ResultData
2223
from databricks.sql.backend.sea.backend import SeaDatabricksClient

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import logging
2+
import uuid
23
import time
34
import re
4-
from typing import Dict, Tuple, List, Optional, Union, TYPE_CHECKING, Set
5+
from typing import Dict, Tuple, List, Optional, Any, Union, TYPE_CHECKING, Set
56

67
from databricks.sql.backend.sea.utils.constants import (
78
ALLOWED_SESSION_CONF_TO_DEFAULT_VALUES_MAP,
@@ -22,7 +23,9 @@
2223
)
2324
from databricks.sql.exc import Error, NotSupportedError, ServerOperationError
2425
from databricks.sql.backend.sea.utils.http_client import SeaHttpClient
26+
from databricks.sql.thrift_api.TCLIService import ttypes
2527
from databricks.sql.types import SSLOptions
28+
from databricks.sql.utils import SeaResultSetQueueFactory
2629
from databricks.sql.backend.sea.models.base import (
2730
ResultData,
2831
ExternalLink,

src/databricks/sql/backend/thrift_backend.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
)
4141

4242
from databricks.sql.utils import (
43-
ThriftResultSetQueueFactory,
4443
_bound,
4544
RequestErrorInfo,
4645
NoRetryReason,

src/databricks/sql/result_set.py

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -474,19 +474,39 @@ def __init__(
474474
result_data: Result data from SEA response (optional)
475475
manifest: Manifest from SEA response (optional)
476476
"""
477+
# Extract and store SEA-specific properties
478+
self.statement_id = (
479+
execute_response.command_id.to_sea_statement_id()
480+
if execute_response.command_id
481+
else None
482+
)
483+
484+
# Build the results queue
485+
results_queue = None
477486

478487
if result_data:
479-
queue = SeaResultSetQueueFactory.build_queue(
480-
sea_result_data=result_data,
481-
manifest=manifest,
482-
statement_id=execute_response.command_id.to_sea_statement_id(),
483-
description=execute_response.description,
484-
schema_bytes=execute_response.arrow_schema_bytes,
488+
from typing import cast, List
489+
490+
# Convert description to the expected format
491+
desc = None
492+
if execute_response.description:
493+
desc = cast(List[Tuple[Any, ...]], execute_response.description)
494+
495+
results_queue = SeaResultSetQueueFactory.build_queue(
496+
result_data,
497+
manifest,
498+
str(self.statement_id),
499+
description=desc,
500+
schema_bytes=execute_response.arrow_schema_bytes
501+
if execute_response.arrow_schema_bytes
502+
else None,
503+
max_download_threads=sea_client.max_download_threads,
504+
ssl_options=sea_client.ssl_options,
505+
sea_client=sea_client,
506+
lz4_compressed=execute_response.lz4_compressed,
485507
)
486-
else:
487-
logger.warning("No result data provided for SEA result set")
488-
queue = JsonQueue([])
489508

509+
# Call parent constructor with common attributes
490510
super().__init__(
491511
connection=connection,
492512
backend=sea_client,
@@ -495,13 +515,15 @@ def __init__(
495515
command_id=execute_response.command_id,
496516
status=execute_response.status,
497517
has_been_closed_server_side=execute_response.has_been_closed_server_side,
498-
results_queue=queue,
499518
description=execute_response.description,
500519
is_staging_operation=execute_response.is_staging_operation,
501520
lz4_compressed=execute_response.lz4_compressed,
502-
arrow_schema_bytes=execute_response.arrow_schema_bytes,
521+
arrow_schema_bytes=execute_response.arrow_schema_bytes or b"",
503522
)
504523

524+
# Initialize queue for result data if not provided
525+
self.results = results_queue or JsonQueue([])
526+
505527
def _convert_to_row_objects(self, rows):
506528
"""
507529
Convert raw data rows to Row objects with named columns based on description.

src/databricks/sql/utils.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616

1717
import lz4.frame
1818

19-
from databricks.sql.backend.sea.backend import SeaDatabricksClient
20-
from databricks.sql.backend.sea.models.base import ResultData, ResultManifest
21-
2219
try:
2320
import pyarrow
2421
except ImportError:

0 commit comments

Comments
 (0)