Skip to content

Commit d92c334

Browse files
committed
Simplify factory to return XarrayRecordBatchReader directly
XarrayRecordBatchReader already implements __arrow_c_stream__, so there's no need to wrap it in pa.RecordBatchReader.from_stream(). The Rust code can consume it directly via ArrowArrayStreamReader::from_pyarrow_bound.
1 parent efb23fd commit d92c334

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

xarray_sql/reader.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,9 @@ def read_xarray_table(
229229
schema = _parse_schema(ds)
230230

231231
# Create a factory function that produces fresh streams on each call
232-
def make_stream() -> pa.RecordBatchReader:
233-
reader = XarrayRecordBatchReader(
232+
def make_stream() -> XarrayRecordBatchReader:
233+
return XarrayRecordBatchReader(
234234
ds, chunks, _iteration_callback=_iteration_callback
235235
)
236-
return pa.RecordBatchReader.from_stream(reader)
237236

238237
return LazyArrowStreamTable(make_stream, schema)

0 commit comments

Comments
 (0)