File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
src/nested_pandas/nestedframe Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -136,8 +136,16 @@ def read_parquet(
136136 field_names = [table .column_names [i ] for i in indices ]
137137
138138 # Use iterchunks to process chunks of each column
139- chunked_arrays = [pa .concat_arrays (list (table .column (i ).iterchunks ())) for i in indices ]
140-
139+ chunked_arrays = []
140+ for i in indices :
141+ column = table .column (i )
142+ if len (column .chunks ) == 1 :
143+ # If there is only one chunk, use it directly
144+ # avoid copy in concat_arrays
145+ chunked_arrays .append (column .chunk (0 ))
146+ else :
147+ # Otherwise, concatenate all chunks
148+ chunked_arrays .append (pa .concat_arrays (list (column .iterchunks ())))
141149 structs [col ] = pa .StructArray .from_arrays (
142150 chunked_arrays , # Child arrays
143151 field_names , # Field names
You can’t perform that action at this time.
0 commit comments