Skip to content

Commit f233886

Browse files
_convert_json_table -> _create_json_table
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parent eeed9a1 commit f233886

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/databricks/sql/result_set.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -471,9 +471,9 @@ def __init__(
471471
manifest: Manifest from SEA response (optional)
472472
"""
473473

474-
results_queue = None
474+
self.results = None
475475
if result_data:
476-
results_queue = SeaResultSetQueueFactory.build_queue(
476+
self.results = SeaResultSetQueueFactory.build_queue(
477477
result_data,
478478
manifest,
479479
str(execute_response.command_id.to_sea_statement_id()),
@@ -498,9 +498,6 @@ def __init__(
498498
arrow_schema_bytes=execute_response.arrow_schema_bytes or b"",
499499
)
500500

501-
# Initialize queue for result data if not provided
502-
self.results = results_queue or JsonQueue([])
503-
504501
def _convert_json_to_arrow(self, rows):
505502
"""
506503
Convert raw data rows to Arrow table.
@@ -546,7 +543,7 @@ def _convert_json_types(self, rows):
546543

547544
return converted_rows
548545

549-
def _convert_json_table(self, rows):
546+
def _create_json_table(self, rows):
550547
"""
551548
Convert raw data rows to Row objects with named columns based on description.
552549
Also converts string values to appropriate Python types based on column metadata.
@@ -645,7 +642,7 @@ def fetchone(self) -> Optional[Row]:
645642
A single Row object or None if no more rows are available
646643
"""
647644
if isinstance(self.results, JsonQueue):
648-
res = self._convert_json_table(self.fetchmany_json(1))
645+
res = self._create_json_table(self.fetchmany_json(1))
649646
else:
650647
raise NotImplementedError("fetchone only supported for JSON data")
651648

@@ -665,7 +662,7 @@ def fetchmany(self, size: int) -> List[Row]:
665662
ValueError: If size is negative
666663
"""
667664
if isinstance(self.results, JsonQueue):
668-
return self._convert_json_table(self.fetchmany_json(size))
665+
return self._create_json_table(self.fetchmany_json(size))
669666
else:
670667
raise NotImplementedError("fetchmany only supported for JSON data")
671668

@@ -677,6 +674,6 @@ def fetchall(self) -> List[Row]:
677674
List of Row objects containing all remaining rows
678675
"""
679676
if isinstance(self.results, JsonQueue):
680-
return self._convert_json_table(self.fetchall_json())
677+
return self._create_json_table(self.fetchall_json())
681678
else:
682679
raise NotImplementedError("fetchall only supported for JSON data")

0 commit comments

Comments
 (0)