Skip to content

Commit 993c3a1

Browse files
attempt combine_chunks
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parent 9c34acd commit 993c3a1

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/databricks/sql/client.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1435,6 +1435,8 @@ def _convert_arrow_table(self, table):
14351435
date_as_object=True,
14361436
timestamp_as_object=True,
14371437
)
1438+
del table
1439+
del table_renamed
14381440

14391441
res = df.to_numpy(na_value=None, dtype="object")
14401442
return [ResultRow(*v) for v in res]
@@ -1465,6 +1467,7 @@ def fetchmany_arrow(self, size: int) -> "pyarrow.Table":
14651467
results = pyarrow.concat_tables([results, partial_results])
14661468
n_remaining_rows -= partial_results.num_rows
14671469
self._next_row_index += partial_results.num_rows
1470+
results = results.combine_chunks()
14681471

14691472
return results
14701473

src/databricks/sql/utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ def next_n_rows(self, num_rows: int) -> "pyarrow.Table":
273273
self.table = self._create_next_table()
274274
self.table_row_index = 0
275275
num_rows -= table_slice.num_rows
276+
results = results.combine_chunks()
276277

277278
logger.debug("CloudFetchQueue: collected {} next rows".format(results.num_rows))
278279
return results
@@ -296,6 +297,7 @@ def remaining_rows(self) -> "pyarrow.Table":
296297
self.table_row_index += table_slice.num_rows
297298
self.table = self._create_next_table()
298299
self.table_row_index = 0
300+
results = results.combine_chunks()
299301
return results
300302

301303
def _create_next_table(self) -> Union["pyarrow.Table", None]:

0 commit comments

Comments
 (0)