Skip to content

Commit 0f1ba57

Browse files
committed
fix: make RecordBatchIterator Send to support multi-threaded consumers like DuckDB
1 parent 03c5f78 commit 0f1ba57

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

connectorx-python/src/arrow.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use std::sync::Arc;
1515
pub struct PyRecordBatch(RecordBatch);
1616

1717
/// Python-exposed iterator over RecordBatches
18-
#[pyclass(unsendable, module = "connectorx")]
18+
#[pyclass(module = "connectorx")]
1919
pub struct PyRecordBatchIterator(Box<dyn RecordBatchIterator>);
2020

2121
#[pymethods]

connectorx/src/arrow_batch_iter.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ where
153153
}
154154
}
155155

156-
pub trait RecordBatchIterator {
156+
pub trait RecordBatchIterator: Send {
157157
fn get_schema(&self) -> (RecordBatch, &[String]);
158158
fn prepare(&mut self);
159159
fn next_batch(&mut self) -> Option<RecordBatch>;
@@ -167,7 +167,7 @@ where
167167
TSD = ArrowStreamTypeSystem,
168168
S = S,
169169
D = ArrowStreamDestination,
170-
>,
170+
>+ std::marker::Send,
171171
{
172172
fn get_schema(&self) -> (RecordBatch, &[String]) {
173173
(self.dst.empty_batch(), self.dst.names())

0 commit comments

Comments
 (0)