Skip to content

Commit f43e12b

Browse files
gatesnclaude
andauthored
Array VTables (#7215)
See #7181 This is a large break that changes how Vortex arrays are held in memory. Previously they were modeled as Arc<dyn Array> where all array impls used a vtable macro to unsafely transmute into a dyn Array. This was cute, but meant that we were performing a lot of unnecessary clones and Arc allocations for things that should never have required them. We were also limited by how expressive we could make APIs since Arc is considered a foreign type. This PR makes ArrayRef a struct, makes typed arrays a struct of `Array<V: VTable>`, and adds an `ArrayView<'a, V>`. This means all arrays are Arc allocated up-front in any of these forms, and we pass the Arc allocation around everywhere allowing us to cheaply clone in either the type-erased or typed structs. The main user-facing change is that array constructors should now live on the vtable struct, e.g. `Primitive::new(...)` instead of `PrimitiveArray::new(...)` --------- Signed-off-by: Nicholas Gates <nick@nickgates.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 38ab5af commit f43e12b

718 files changed

Lines changed: 23757 additions & 20555 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

benchmarks/compress-bench/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub fn chunked_to_vec_record_batch(
2323
// TODO(connor)[ListView]: The rust Parquet implementation does not support writing
2424
// `ListView` to Parquet files yet.
2525
let converted_array = recursive_list_from_list_view(array.clone())?;
26-
Ok(RecordBatch::try_from(converted_array.as_ref())?)
26+
Ok(RecordBatch::try_from(&converted_array)?)
2727
})
2828
.collect::<anyhow::Result<Vec<_>>>()?;
2929

benchmarks/compress-bench/src/vortex.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use async_trait::async_trait;
1212
use bytes::Bytes;
1313
use futures::StreamExt;
1414
use futures::pin_mut;
15+
use vortex::array::IntoArray;
1516
use vortex::file::OpenOptionsSessionExt;
1617
use vortex::file::WriteOptionsSessionExt;
1718
use vortex_bench::Format;
@@ -37,7 +38,7 @@ impl Compressor for VortexCompressor {
3738
let mut cursor = Cursor::new(&mut buf);
3839
SESSION
3940
.write_options()
40-
.write(&mut cursor, uncompressed.to_array_stream())
41+
.write(&mut cursor, uncompressed.into_array().to_array_stream())
4142
.await?;
4243
let elapsed = start.elapsed();
4344

@@ -51,7 +52,7 @@ impl Compressor for VortexCompressor {
5152
let mut cursor = Cursor::new(&mut buf);
5253
SESSION
5354
.write_options()
54-
.write(&mut cursor, uncompressed.to_array_stream())
55+
.write(&mut cursor, uncompressed.into_array().to_array_stream())
5556
.await?;
5657

5758
// Now decompress

encodings/alp/public-api.lock

Lines changed: 158 additions & 156 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)