Skip to content

Commit 8a138e8

Browse files
allow empty schema bytes for alignment with SEA
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parent 54eb0a4 commit 8a138e8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/databricks/sql/utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ def __init__(
297297
self,
298298
max_download_threads: int,
299299
ssl_options: SSLOptions,
300-
schema_bytes: bytes,
300+
schema_bytes: Optional[bytes] = None,
301301
lz4_compressed: bool = True,
302302
description: Optional[List[Tuple]] = None,
303303
):
@@ -406,6 +406,8 @@ def next_n_rows(self, num_rows: int) -> "pyarrow.Table":
406406

407407
def _create_empty_table(self) -> "pyarrow.Table":
408408
"""Create a 0-row table with just the schema bytes."""
409+
if not self.schema_bytes:
410+
return pyarrow.Table.from_pydict({})
409411
return create_arrow_table_from_arrow_file(self.schema_bytes, self.description)
410412

411413
def _create_table_at_offset(self, offset: int) -> Union["pyarrow.Table", None]:
@@ -549,7 +551,7 @@ def __init__(
549551
super().__init__(
550552
max_download_threads=max_download_threads,
551553
ssl_options=ssl_options,
552-
schema_bytes=b"",
554+
schema_bytes=None,
553555
lz4_compressed=lz4_compressed,
554556
description=description,
555557
)

0 commit comments

Comments
 (0)