Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
e468b71
Give layout scans a native split and open
gatesn Nov 19, 2026
540b8cc
Spawn pool splits onto the session runtime
gatesn Nov 19, 2026
f9241d7
Read DataFusion v2 scans through split and open
gatesn Nov 19, 2026
d135991
Split the v2 test scan into one piece per partition
gatesn Nov 19, 2026
be5ce7a
Convert scan workers to Arrow through vortex-arrow
gatesn Nov 19, 2026
d2b0617
Add a datafusion-bench flag for the Scan API table path
gatesn Nov 19, 2026
2d3e3e7
Keep the shared partition stream behind VORTEX_SCAN_POOL=0
gatesn Nov 20, 2026
3bc99c3
Merge the reworked scan-native-pool base
gatesn Nov 20, 2026
c2f3e57
Merge the final scan-native-pool foundation
gatesn Nov 20, 2026
a36941c
Merge the shared-output scan-native-pool foundation
gatesn Nov 20, 2026
4272dca
Stop assuming a scan pool's workers own their work
gatesn Nov 20, 2026
27fa36a
Merge the file-rotating scan-native-pool foundation
gatesn Nov 20, 2026
9d1bc30
Merge the coalescing scan-native-pool foundation
gatesn Nov 20, 2026
25e4243
Merge the parallel-decode scan-native-pool foundation
gatesn Nov 20, 2026
86c9e14
Merge the scan-native-pool foundation with develop
gatesn Nov 20, 2026
ebbafe8
Merge the reworked scan-native-pool foundation
gatesn Nov 20, 2026
9dc8962
Merge the scan-native-pool foundation's test fix
gatesn Nov 20, 2026
ddd24ce
Merge the read-ahead scan-native-pool foundation
gatesn Nov 20, 2026
43a207e
Merge the trimmed scan-native-pool foundation
gatesn Nov 20, 2026
b40dc55
Read each VortexTable output partition from its own split piece
gatesn Nov 20, 2026
4b7546e
Merge the scan-native-pool foundation with required partitions
gatesn Nov 20, 2026
4f3b62b
Split each VortexTable execution once and share its pieces
gatesn Nov 20, 2026
b6606f1
Merge #11663's ScanStream API and read pieces as streams
gatesn Nov 20, 2026
5117956
Merge branch 'ngates/scan-native-pool' of github.com:vortex-data/vort…
gatesn Nov 20, 2026
1569d39
Describe to_arrow's input as a piece of a split scan
gatesn Nov 20, 2026
7f80421
Cancel a scan execution when an unfinished output partition drops
gatesn Nov 20, 2026
788789b
Merge branch 'ngates/scan-native-pool' of github.com:vortex-data/vort…
gatesn Nov 20, 2026
69408fc
Merge branch 'ngates/scan-native-pool' of github.com:vortex-data/vort…
gatesn Nov 20, 2026
9d11499
Share unordered scan work through clones of one opened stream
gatesn Nov 20, 2026
ebcb6b4
Merge branch 'ngates/scan-native-pool' of github.com:vortex-data/vort…
gatesn Nov 20, 2026
c102c2c
Read declared orderings through one ordered split piece per partition
gatesn Nov 20, 2026
c55c047
Hold the shared scan stream behind a mutex so the execution is Sync
gatesn Nov 20, 2026
f4c7554
Merge ngates/scan-native-pool into ngates/datafusion-scan-pool
gatesn Nov 24, 2026
24b6662
Merge ngates/scan-native-pool into ngates/datafusion-scan-pool
gatesn Nov 24, 2026
006e810
Merge ngates/scan-native-pool into ngates/datafusion-scan-pool
gatesn Nov 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vortex-arrow/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ vortex-array = { workspace = true }
vortex-buffer = { workspace = true, features = ["arrow"] }
vortex-error = { workspace = true }
vortex-functions = { workspace = true }
vortex-io = { workspace = true }
vortex-mask = { workspace = true }
vortex-scan = { workspace = true }
vortex-session = { workspace = true }
Expand Down
2 changes: 2 additions & 0 deletions vortex-arrow/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ mod run_end_import;
mod scalar;
mod scan;
mod session;
mod stream;
#[cfg(feature = "_test-harness")]
pub mod test_harness;
#[cfg(test)]
Expand All @@ -55,3 +56,4 @@ pub use options::*;
pub use scalar::ToArrowDatum;
pub use scan::ArrowScanExt;
pub use session::*;
pub use stream::ArrowArrayStreamExt;
116 changes: 116 additions & 0 deletions vortex-arrow/src/stream.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright the Vortex contributors

//! Arrow output for array streams.

use std::future;
use std::num::NonZeroUsize;
use std::sync::Arc;

use arrow_array::RecordBatch;
use arrow_array::cast::AsArray;
use arrow_schema::Field;
use arrow_schema::SchemaRef;
use futures::StreamExt;
use futures::stream;
use futures::stream::BoxStream;
use vortex_array::VortexSessionExecute;
use vortex_array::stream::ArrayStream;
use vortex_error::VortexResult;
use vortex_io::session::RuntimeSessionExt;
use vortex_session::VortexSession;

use crate::ArrowSessionExt;
use crate::ExecuteArrowExt;

/// Arrow record-batch output for an [`ArrayStream`], such as a piece of a split scan.
pub trait ArrowArrayStreamExt: ArrayStream + Send + Sized + 'static {
/// Converts each array of the stream to an Arrow [`RecordBatch`] with `schema`.
///
/// Each conversion runs as a CPU task on the session's runtime, with at most `concurrency`
/// in flight, and the batches keep the stream's order. When `schema` is `None`, the session
/// derives it from the stream's dtype.
fn to_arrow(
self,
session: &VortexSession,
schema: Option<SchemaRef>,
concurrency: NonZeroUsize,
) -> BoxStream<'static, VortexResult<RecordBatch>> {
let schema = match schema {
Some(schema) => schema,
None => match session.arrow().to_arrow_schema(self.dtype()) {
Ok(schema) => Arc::new(schema),
Err(error) => return stream::once(future::ready(Err(error))).boxed(),
},
};
let field = Arc::new(Field::new_struct("", schema.fields().clone(), false));
let session = session.clone();
let handle = session.handle();
self.map(move |array| {
let session = session.clone();
let field = Arc::clone(&field);
handle.spawn_cpu(move || {
let arrow =
array?.execute_arrow(Some(&field), &mut session.create_execution_ctx())?;
Ok(RecordBatch::from(arrow.as_struct().clone()))
})
})
.buffered(concurrency.get())
.boxed()
}
}

impl<S: ArrayStream + Send + 'static> ArrowArrayStreamExt for S {}

#[cfg(test)]
mod tests {
use std::num::NonZeroUsize;

use arrow_array::cast::AsArray;
use arrow_array::types::Int32Type;
use futures::TryStreamExt;
use futures::stream;
use vortex_array::IntoArray;
use vortex_array::arrays::StructArray;
use vortex_array::stream::ArrayStreamAdapter;
use vortex_buffer::buffer;
use vortex_error::VortexResult;
use vortex_io::runtime::single::block_on;
use vortex_io::session::RuntimeSessionExt;
use vortex_session::VortexSession;

use super::ArrowArrayStreamExt;

#[test]
fn converts_each_array_in_order() -> VortexResult<()> {
let arrays = [buffer![0i32, 1], buffer![2i32], buffer![3i32, 4, 5]]
.into_iter()
.map(|values| {
StructArray::from_fields(&[("a", values.into_array())]).map(IntoArray::into_array)
})
.collect::<VortexResult<Vec<_>>>()?;
let dtype = arrays[0].dtype().clone();
let batches: Vec<_> = block_on(|handle| {
let session = VortexSession::empty().with_handle(handle);
ArrayStreamAdapter::new(dtype, stream::iter(arrays.into_iter().map(Ok)))
.to_arrow(
&session,
None,
NonZeroUsize::new(2).unwrap_or(NonZeroUsize::MIN),
)
.try_collect()
})?;
let values: Vec<i32> = batches
.iter()
.flat_map(|batch| {
batch
.column(0)
.as_primitive::<Int32Type>()
.values()
.to_vec()
})
.collect();
assert_eq!(values, [0, 1, 2, 3, 4, 5]);
Ok(())
}
}
1 change: 1 addition & 0 deletions vortex-datafusion/src/v2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,6 @@ mod table;
#[cfg(test)]
mod tests;

pub use source::SCAN_POOL_ENV;
pub use source::VortexDataSource;
pub use table::VortexTable;
Loading