File tree 1 file changed +5
-11
lines changed 1 file changed +5
-11
lines changed Original file line number Diff line number Diff line change 23
23
import fsspec
24
24
import os
25
25
import pandas as pd
26
- import pyarrow as pa
27
26
import tempfile
28
27
from pyarrow .dataset import dataset
29
28
@@ -131,14 +130,9 @@ def __to_pandas_kernel(self):
131
130
return pd .DataFrame (columns = schema .names )
132
131
133
132
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 )
142
136
143
137
# Apply residual limit that was not handled from server pushdown
144
138
result = result .head (self ._limit )
@@ -372,8 +366,8 @@ def __table_changes_to_pandas_kernel(self, cdfOptions: CdfOptions) -> pd.DataFra
372
366
schema = scan .execute (interface ).schema
373
367
result = pd .DataFrame (columns = schema .names )
374
368
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 )
377
371
finally :
378
372
# Delete the temp folder explicitly and remove the delta format from header
379
373
temp_dir .cleanup ()
You can’t perform that action at this time.
0 commit comments