diff --git a/python/dremio-flight/dremio/flight/query.py b/python/dremio-flight/dremio/flight/query.py index f6e61de1..bc9271bf 100644 --- a/python/dremio-flight/dremio/flight/query.py +++ b/python/dremio-flight/dremio/flight/query.py @@ -55,13 +55,14 @@ def execute_query(self) -> DataFrame: def _get_chunks(self, reader: flight.FlightStreamReader) -> DataFrame: dataframe = DataFrame() + chunks = [] while True: try: flight_batch = reader.read_chunk() record_batch = flight_batch.data data_to_pandas = record_batch.to_pandas() - dataframe = concat([dataframe, data_to_pandas]) + chunks.append(data_to_pandas) except StopIteration: break - return dataframe + return concat(chunks)