Skip to content

Commit 09e1a38

Browse files
committed
add args to to_pandas and update cdf path too
1 parent 89b6cd4 commit 09e1a38

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

python/delta_sharing/reader.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import fsspec
2424
import os
2525
import pandas as pd
26-
import pyarrow as pa
2726
import tempfile
2827
from pyarrow.dataset import dataset
2928

@@ -131,14 +130,9 @@ def __to_pandas_kernel(self):
131130
return pd.DataFrame(columns=schema.names)
132131

133132
batches = scan.execute(interface)
134-
pdfs = [batch.to_pandas() for batch in batches]
135-
136-
result = pd.concat(
137-
pdfs,
138-
axis=0,
139-
ignore_index=True,
140-
copy=False,
141-
)
133+
pdfs = [batch.to_pandas(self_destruct=True) for batch in batches]
134+
135+
result = pd.concat(pdfs, axis=0, ignore_index=True, copy=False)
142136

143137
# Apply residual limit that was not handled from server pushdown
144138
result = result.head(self._limit)
@@ -372,8 +366,8 @@ def __table_changes_to_pandas_kernel(self, cdfOptions: CdfOptions) -> pd.DataFra
372366
schema = scan.execute(interface).schema
373367
result = pd.DataFrame(columns=schema.names)
374368
else:
375-
table = pa.Table.from_batches(scan.execute(interface))
376-
result = table.to_pandas()
369+
pdfs = [batch.to_pandas(self_destruct=True) for batch in scan.execute(interface)]
370+
result = pd.concat(pdfs, axis=0, ignore_index=True, copy=False)
377371
finally:
378372
# Delete the temp folder explicitly and remove the delta format from header
379373
temp_dir.cleanup()

0 commit comments

Comments
 (0)