From c128e60e01e821ae2e50acb3fb06a855127de1cc Mon Sep 17 00:00:00 2001 From: Nicholas Gates Date: Mon, 2 Mar 2026 16:22:15 -0500 Subject: [PATCH 1/5] Add typed array Signed-off-by: Nicholas Gates --- vortex-array/src/array/mod.rs | 6 +++- vortex-array/src/array/typed.rs | 53 +++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 vortex-array/src/array/typed.rs diff --git a/vortex-array/src/array/mod.rs b/vortex-array/src/array/mod.rs index fc47631f35a..b9dca3c8da9 100644 --- a/vortex-array/src/array/mod.rs +++ b/vortex-array/src/array/mod.rs @@ -2,6 +2,10 @@ // SPDX-FileCopyrightText: Copyright the Vortex contributors mod visitor; +pub use visitor::*; + +mod typed; +pub use typed::*; use std::any::Any; use std::fmt::Debug; @@ -12,7 +16,6 @@ use std::ops::Deref; use std::ops::Range; use std::sync::Arc; -pub use visitor::*; use vortex_buffer::ByteBuffer; use vortex_error::VortexExpect; use vortex_error::VortexResult; @@ -372,6 +375,7 @@ mod private { pub trait Sealed {} impl Sealed for ArrayAdapter {} + impl Sealed for Array {} impl Sealed for Arc {} } diff --git a/vortex-array/src/array/typed.rs b/vortex-array/src/array/typed.rs new file mode 100644 index 00000000000..74618d1985a --- /dev/null +++ b/vortex-array/src/array/typed.rs @@ -0,0 +1,53 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Copyright the Vortex contributors + +use crate::dtype::DType; +use crate::stats::{ArrayStats, StatsSetRef}; +use crate::vtable::VTable; +use crate::ArrayRef; +use std::ops::Deref; + +/// The typed representation of a Vortex array, pairing a vtable with its array data and other +/// common fields. +#[derive(Debug, Clone)] +pub struct Array { + vtable: V, + len: usize, + dtype: DType, + data: V::Array, + child_slots: Vec>, + stats: ArrayStats, +} + +/// Deref to the inner array data for convenient access to typed accessors. +impl Deref for Array { + type Target = V::Array; + + fn deref(&self) -> &Self::Target { + &self.data + } +} + +impl Array { + /// Returns the length of the array. + #[inline(always)] + pub fn len(&self) -> usize { + self.len + } + + /// Returns whether the array is empty. + #[inline(always)] + pub fn is_empty(&self) -> bool { + self.len == 0 + } + + /// Returns the dtype of the array. + pub fn dtype(&self) -> &DType { + &self.dtype + } + + /// Returns the stats of the array. + pub fn stats(&self) -> &ArrayStats { + &self.stats + } +} From 697c6e6c46213c7b8a761a45709976ad0c76e39e Mon Sep 17 00:00:00 2001 From: Nicholas Gates Date: Mon, 2 Mar 2026 22:20:25 -0500 Subject: [PATCH 2/5] Phase 1 Signed-off-by: Nicholas Gates --- encodings/alp/src/alp/array.rs | 9 +- encodings/alp/src/alp_rd/array.rs | 9 +- encodings/bytebool/src/array.rs | 9 +- encodings/datetime-parts/src/array.rs | 9 +- .../src/decimal_byte_parts/mod.rs | 9 +- .../fastlanes/src/bitpacking/array/mod.rs | 7 + .../fastlanes/src/bitpacking/vtable/mod.rs | 2 +- encodings/fastlanes/src/delta/array/mod.rs | 7 + encodings/fastlanes/src/delta/vtable/mod.rs | 2 +- encodings/fastlanes/src/for/array/mod.rs | 7 + encodings/fastlanes/src/for/vtable/mod.rs | 2 +- encodings/fastlanes/src/rle/array/mod.rs | 7 + encodings/fastlanes/src/rle/vtable/mod.rs | 2 +- encodings/fsst/src/array.rs | 9 +- encodings/pco/src/array.rs | 9 +- encodings/runend/src/array.rs | 9 +- encodings/sequence/src/array.rs | 9 +- encodings/sparse/src/lib.rs | 9 +- encodings/zigzag/src/array.rs | 9 +- encodings/zstd/src/array.rs | 9 +- encodings/zstd/src/zstd_buffers.rs | 9 +- vortex-array/src/array/mod.rs | 33 +- vortex-array/src/array/typed.rs | 447 +++++++++++++++++- vortex-array/src/arrays/bool/array.rs | 7 + vortex-array/src/arrays/bool/vtable/mod.rs | 2 +- vortex-array/src/arrays/chunked/array.rs | 7 + vortex-array/src/arrays/chunked/vtable/mod.rs | 2 +- vortex-array/src/arrays/constant/array.rs | 7 + .../src/arrays/constant/vtable/mod.rs | 2 +- vortex-array/src/arrays/decimal/array.rs | 7 + vortex-array/src/arrays/decimal/vtable/mod.rs | 2 +- vortex-array/src/arrays/dict/array.rs | 7 + vortex-array/src/arrays/dict/vtable/mod.rs | 2 +- vortex-array/src/arrays/extension/array.rs | 7 + .../src/arrays/extension/vtable/mod.rs | 2 +- vortex-array/src/arrays/filter/array.rs | 7 + vortex-array/src/arrays/filter/vtable.rs | 2 +- .../src/arrays/fixed_size_list/array.rs | 7 + .../src/arrays/fixed_size_list/vtable/mod.rs | 2 +- vortex-array/src/arrays/list/array.rs | 7 + vortex-array/src/arrays/list/vtable/mod.rs | 2 +- vortex-array/src/arrays/listview/array.rs | 7 + .../src/arrays/listview/vtable/mod.rs | 2 +- vortex-array/src/arrays/masked/array.rs | 7 + vortex-array/src/arrays/masked/vtable/mod.rs | 2 +- vortex-array/src/arrays/null/mod.rs | 9 +- .../src/arrays/primitive/array/mod.rs | 7 + .../src/arrays/primitive/vtable/mod.rs | 2 +- vortex-array/src/arrays/scalar_fn/array.rs | 7 + vortex-array/src/arrays/shared/array.rs | 7 + vortex-array/src/arrays/shared/vtable.rs | 2 +- vortex-array/src/arrays/slice/array.rs | 7 + vortex-array/src/arrays/slice/vtable.rs | 2 +- vortex-array/src/arrays/struct_/array.rs | 7 + vortex-array/src/arrays/struct_/vtable/mod.rs | 2 +- vortex-array/src/arrays/varbin/array.rs | 7 + vortex-array/src/arrays/varbin/vtable/mod.rs | 2 +- vortex-array/src/arrays/varbinview/array.rs | 7 + .../src/arrays/varbinview/vtable/mod.rs | 2 +- vortex-array/src/stats/array.rs | 7 + vortex-array/src/vtable/dyn_.rs | 9 +- vortex-array/src/vtable/mod.rs | 15 +- vortex-python/src/arrays/py/array.rs | 7 + vortex-python/src/arrays/py/vtable.rs | 2 +- 64 files changed, 765 insertions(+), 77 deletions(-) diff --git a/encodings/alp/src/alp/array.rs b/encodings/alp/src/alp/array.rs index 22125f4a89a..53dae216651 100644 --- a/encodings/alp/src/alp/array.rs +++ b/encodings/alp/src/alp/array.rs @@ -21,6 +21,7 @@ use vortex_array::patches::Patches; use vortex_array::patches::PatchesMetadata; use vortex_array::serde::ArrayChildren; use vortex_array::stats::ArrayStats; +use vortex_array::stats::HasArrayStats; use vortex_array::stats::StatsSetRef; use vortex_array::vtable; use vortex_array::vtable::ArrayId; @@ -266,7 +267,13 @@ pub struct ALPArray { stats_set: ArrayStats, } -#[derive(Debug)] +impl HasArrayStats for ALPArray { + fn array_stats(&self) -> &ArrayStats { + &self.stats_set + } +} + +#[derive(Clone, Debug)] pub struct ALPVTable; impl ALPVTable { diff --git a/encodings/alp/src/alp_rd/array.rs b/encodings/alp/src/alp_rd/array.rs index e015937ae78..52ffa0def14 100644 --- a/encodings/alp/src/alp_rd/array.rs +++ b/encodings/alp/src/alp_rd/array.rs @@ -24,6 +24,7 @@ use vortex_array::patches::Patches; use vortex_array::patches::PatchesMetadata; use vortex_array::serde::ArrayChildren; use vortex_array::stats::ArrayStats; +use vortex_array::stats::HasArrayStats; use vortex_array::stats::StatsSetRef; use vortex_array::validity::Validity; use vortex_array::vtable; @@ -366,7 +367,13 @@ pub struct ALPRDArray { stats_set: ArrayStats, } -#[derive(Debug)] +impl HasArrayStats for ALPRDArray { + fn array_stats(&self) -> &ArrayStats { + &self.stats_set + } +} + +#[derive(Clone, Debug)] pub struct ALPRDVTable; impl ALPRDVTable { diff --git a/encodings/bytebool/src/array.rs b/encodings/bytebool/src/array.rs index c7e21795a12..64ee4e229af 100644 --- a/encodings/bytebool/src/array.rs +++ b/encodings/bytebool/src/array.rs @@ -17,6 +17,7 @@ use vortex_array::dtype::DType; use vortex_array::scalar::Scalar; use vortex_array::serde::ArrayChildren; use vortex_array::stats::ArrayStats; +use vortex_array::stats::HasArrayStats; use vortex_array::stats::StatsSetRef; use vortex_array::validity::Validity; use vortex_array::vtable; @@ -206,7 +207,13 @@ pub struct ByteBoolArray { stats_set: ArrayStats, } -#[derive(Debug)] +impl HasArrayStats for ByteBoolArray { + fn array_stats(&self) -> &ArrayStats { + &self.stats_set + } +} + +#[derive(Clone, Debug)] pub struct ByteBoolVTable; impl ByteBoolVTable { diff --git a/encodings/datetime-parts/src/array.rs b/encodings/datetime-parts/src/array.rs index f8b89d1d066..fcb6977a9f5 100644 --- a/encodings/datetime-parts/src/array.rs +++ b/encodings/datetime-parts/src/array.rs @@ -20,6 +20,7 @@ use vortex_array::dtype::Nullability; use vortex_array::dtype::PType; use vortex_array::serde::ArrayChildren; use vortex_array::stats::ArrayStats; +use vortex_array::stats::HasArrayStats; use vortex_array::stats::StatsSetRef; use vortex_array::vtable; use vortex_array::vtable::ArrayId; @@ -252,6 +253,12 @@ pub struct DateTimePartsArray { stats_set: ArrayStats, } +impl HasArrayStats for DateTimePartsArray { + fn array_stats(&self) -> &ArrayStats { + &self.stats_set + } +} + #[derive(Clone, Debug)] pub struct DateTimePartsArrayParts { pub dtype: DType, @@ -260,7 +267,7 @@ pub struct DateTimePartsArrayParts { pub subseconds: ArrayRef, } -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct DateTimePartsVTable; impl DateTimePartsVTable { diff --git a/encodings/decimal-byte-parts/src/decimal_byte_parts/mod.rs b/encodings/decimal-byte-parts/src/decimal_byte_parts/mod.rs index eec4fa1aae4..0854e754d99 100644 --- a/encodings/decimal-byte-parts/src/decimal_byte_parts/mod.rs +++ b/encodings/decimal-byte-parts/src/decimal_byte_parts/mod.rs @@ -29,6 +29,7 @@ use vortex_array::scalar::Scalar; use vortex_array::scalar::ScalarValue; use vortex_array::serde::ArrayChildren; use vortex_array::stats::ArrayStats; +use vortex_array::stats::HasArrayStats; use vortex_array::stats::StatsSetRef; use vortex_array::vtable; use vortex_array::vtable::ArrayId; @@ -220,6 +221,12 @@ pub struct DecimalBytePartsArray { stats_set: ArrayStats, } +impl HasArrayStats for DecimalBytePartsArray { + fn array_stats(&self) -> &ArrayStats { + &self.stats_set + } +} + pub struct DecimalBytePartsArrayParts { pub msp: ArrayRef, pub dtype: DType, @@ -269,7 +276,7 @@ impl DecimalBytePartsArray { } } -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct DecimalBytePartsVTable; impl DecimalBytePartsVTable { diff --git a/encodings/fastlanes/src/bitpacking/array/mod.rs b/encodings/fastlanes/src/bitpacking/array/mod.rs index cffeac17090..fdc22521fc8 100644 --- a/encodings/fastlanes/src/bitpacking/array/mod.rs +++ b/encodings/fastlanes/src/bitpacking/array/mod.rs @@ -10,6 +10,7 @@ use vortex_array::dtype::NativePType; use vortex_array::dtype::PType; use vortex_array::patches::Patches; use vortex_array::stats::ArrayStats; +use vortex_array::stats::HasArrayStats; use vortex_array::validity::Validity; use vortex_error::VortexResult; use vortex_error::vortex_bail; @@ -46,6 +47,12 @@ pub struct BitPackedArray { pub(super) stats_set: ArrayStats, } +impl HasArrayStats for BitPackedArray { + fn array_stats(&self) -> &ArrayStats { + &self.stats_set + } +} + impl BitPackedArray { /// Create a new bitpacked array using a buffer of packed data. /// diff --git a/encodings/fastlanes/src/bitpacking/vtable/mod.rs b/encodings/fastlanes/src/bitpacking/vtable/mod.rs index d213fb9f1ed..f0fbe779b28 100644 --- a/encodings/fastlanes/src/bitpacking/vtable/mod.rs +++ b/encodings/fastlanes/src/bitpacking/vtable/mod.rs @@ -367,7 +367,7 @@ impl VTable for BitPackedVTable { } } -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct BitPackedVTable; impl BitPackedVTable { diff --git a/encodings/fastlanes/src/delta/array/mod.rs b/encodings/fastlanes/src/delta/array/mod.rs index 66e3208c926..9f0fcfdcb82 100644 --- a/encodings/fastlanes/src/delta/array/mod.rs +++ b/encodings/fastlanes/src/delta/array/mod.rs @@ -10,6 +10,7 @@ use vortex_array::dtype::NativePType; use vortex_array::dtype::PType; use vortex_array::match_each_unsigned_integer_ptype; use vortex_array::stats::ArrayStats; +use vortex_array::stats::HasArrayStats; use vortex_array::validity::Validity; use vortex_buffer::Buffer; use vortex_error::VortexExpect as _; @@ -63,6 +64,12 @@ pub struct DeltaArray { pub(super) stats_set: ArrayStats, } +impl HasArrayStats for DeltaArray { + fn array_stats(&self) -> &ArrayStats { + &self.stats_set + } +} + impl DeltaArray { // TODO(ngates): remove constructing from vec pub fn try_from_vec(vec: Vec) -> VortexResult { diff --git a/encodings/fastlanes/src/delta/vtable/mod.rs b/encodings/fastlanes/src/delta/vtable/mod.rs index 96c0e0dd248..801754d2434 100644 --- a/encodings/fastlanes/src/delta/vtable/mod.rs +++ b/encodings/fastlanes/src/delta/vtable/mod.rs @@ -194,7 +194,7 @@ impl VTable for DeltaVTable { } } -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct DeltaVTable; impl DeltaVTable { diff --git a/encodings/fastlanes/src/for/array/mod.rs b/encodings/fastlanes/src/for/array/mod.rs index 18f4e6ee415..20371602d75 100644 --- a/encodings/fastlanes/src/for/array/mod.rs +++ b/encodings/fastlanes/src/for/array/mod.rs @@ -5,6 +5,7 @@ use vortex_array::ArrayRef; use vortex_array::dtype::PType; use vortex_array::scalar::Scalar; use vortex_array::stats::ArrayStats; +use vortex_array::stats::HasArrayStats; use vortex_error::VortexResult; use vortex_error::vortex_bail; @@ -22,6 +23,12 @@ pub struct FoRArray { pub(super) stats_set: ArrayStats, } +impl HasArrayStats for FoRArray { + fn array_stats(&self) -> &ArrayStats { + &self.stats_set + } +} + impl FoRArray { pub fn try_new(encoded: ArrayRef, reference: Scalar) -> VortexResult { if reference.is_null() { diff --git a/encodings/fastlanes/src/for/vtable/mod.rs b/encodings/fastlanes/src/for/vtable/mod.rs index cef31f8250c..7e4cbcea4e7 100644 --- a/encodings/fastlanes/src/for/vtable/mod.rs +++ b/encodings/fastlanes/src/for/vtable/mod.rs @@ -179,7 +179,7 @@ impl VTable for FoRVTable { } } -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct FoRVTable; impl FoRVTable { diff --git a/encodings/fastlanes/src/rle/array/mod.rs b/encodings/fastlanes/src/rle/array/mod.rs index 797ba66224d..f72157bfd32 100644 --- a/encodings/fastlanes/src/rle/array/mod.rs +++ b/encodings/fastlanes/src/rle/array/mod.rs @@ -6,6 +6,7 @@ use vortex_array::DynArray; use vortex_array::dtype::DType; use vortex_array::dtype::PType; use vortex_array::stats::ArrayStats; +use vortex_array::stats::HasArrayStats; use vortex_error::VortexResult; use vortex_error::vortex_ensure; @@ -38,6 +39,12 @@ pub struct RLEArray { pub(super) length: usize, } +impl HasArrayStats for RLEArray { + fn array_stats(&self) -> &ArrayStats { + &self.stats_set + } +} + impl RLEArray { fn validate( values: &ArrayRef, diff --git a/encodings/fastlanes/src/rle/vtable/mod.rs b/encodings/fastlanes/src/rle/vtable/mod.rs index 0a682d3abf7..35a577865ff 100644 --- a/encodings/fastlanes/src/rle/vtable/mod.rs +++ b/encodings/fastlanes/src/rle/vtable/mod.rs @@ -235,7 +235,7 @@ impl VTable for RLEVTable { } } -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct RLEVTable; impl RLEVTable { diff --git a/encodings/fsst/src/array.rs b/encodings/fsst/src/array.rs index 175ca6fdb59..fb3395eae5a 100644 --- a/encodings/fsst/src/array.rs +++ b/encodings/fsst/src/array.rs @@ -31,6 +31,7 @@ use vortex_array::dtype::Nullability; use vortex_array::dtype::PType; use vortex_array::serde::ArrayChildren; use vortex_array::stats::ArrayStats; +use vortex_array::stats::HasArrayStats; use vortex_array::stats::StatsSetRef; use vortex_array::validity::Validity; use vortex_array::vtable; @@ -376,6 +377,12 @@ pub struct FSSTArray { compressor: Arc Compressor + Send>>>, } +impl HasArrayStats for FSSTArray { + fn array_stats(&self) -> &ArrayStats { + &self.stats_set + } +} + impl Debug for FSSTArray { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { f.debug_struct("FSSTArray") @@ -388,7 +395,7 @@ impl Debug for FSSTArray { } } -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct FSSTVTable; impl FSSTVTable { diff --git a/encodings/pco/src/array.rs b/encodings/pco/src/array.rs index e1c99d37d45..2dcb465c803 100644 --- a/encodings/pco/src/array.rs +++ b/encodings/pco/src/array.rs @@ -33,6 +33,7 @@ use vortex_array::dtype::half; use vortex_array::scalar::Scalar; use vortex_array::serde::ArrayChildren; use vortex_array::stats::ArrayStats; +use vortex_array::stats::HasArrayStats; use vortex_array::stats::StatsSetRef; use vortex_array::validity::Validity; use vortex_array::vtable; @@ -305,7 +306,7 @@ pub(crate) fn vortex_err_from_pco(err: PcoError) -> VortexError { } } -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct PcoVTable; impl PcoVTable { @@ -325,6 +326,12 @@ pub struct PcoArray { slice_stop: usize, } +impl HasArrayStats for PcoArray { + fn array_stats(&self) -> &ArrayStats { + &self.stats_set + } +} + impl PcoArray { pub fn new( chunk_metas: Vec, diff --git a/encodings/runend/src/array.rs b/encodings/runend/src/array.rs index 267920c81e4..09108b44d0c 100644 --- a/encodings/runend/src/array.rs +++ b/encodings/runend/src/array.rs @@ -24,6 +24,7 @@ use vortex_array::search_sorted::SearchSorted; use vortex_array::search_sorted::SearchSortedSide; use vortex_array::serde::ArrayChildren; use vortex_array::stats::ArrayStats; +use vortex_array::stats::HasArrayStats; use vortex_array::stats::StatsSetRef; use vortex_array::validity::Validity; use vortex_array::vtable; @@ -214,12 +215,18 @@ pub struct RunEndArray { stats_set: ArrayStats, } +impl HasArrayStats for RunEndArray { + fn array_stats(&self) -> &ArrayStats { + &self.stats_set + } +} + pub struct RunEndArrayParts { pub ends: ArrayRef, pub values: ArrayRef, } -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct RunEndVTable; impl RunEndVTable { diff --git a/encodings/sequence/src/array.rs b/encodings/sequence/src/array.rs index 33612e94b67..94fb6dcba95 100644 --- a/encodings/sequence/src/array.rs +++ b/encodings/sequence/src/array.rs @@ -26,6 +26,7 @@ use vortex_array::scalar::Scalar; use vortex_array::scalar::ScalarValue; use vortex_array::serde::ArrayChildren; use vortex_array::stats::ArrayStats; +use vortex_array::stats::HasArrayStats; use vortex_array::stats::StatsSet; use vortex_array::stats::StatsSetRef; use vortex_array::validity::Validity; @@ -81,6 +82,12 @@ pub struct SequenceArray { stats_set: ArrayStats, } +impl HasArrayStats for SequenceArray { + fn array_stats(&self) -> &ArrayStats { + &self.stats_set + } +} + impl SequenceArray { pub fn try_new_typed>( base: T, @@ -417,7 +424,7 @@ impl ValidityVTable for SequenceVTable { } } -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct SequenceVTable; impl SequenceVTable { diff --git a/encodings/sparse/src/lib.rs b/encodings/sparse/src/lib.rs index 69cf9ca715d..79e2efec9b8 100644 --- a/encodings/sparse/src/lib.rs +++ b/encodings/sparse/src/lib.rs @@ -26,6 +26,7 @@ use vortex_array::scalar::ScalarValue; use vortex_array::scalar_fn::fns::operators::Operator; use vortex_array::serde::ArrayChildren; use vortex_array::stats::ArrayStats; +use vortex_array::stats::HasArrayStats; use vortex_array::stats::StatsSetRef; use vortex_array::validity::Validity; use vortex_array::vtable; @@ -267,7 +268,13 @@ pub struct SparseArray { stats_set: ArrayStats, } -#[derive(Debug)] +impl HasArrayStats for SparseArray { + fn array_stats(&self) -> &ArrayStats { + &self.stats_set + } +} + +#[derive(Clone, Debug)] pub struct SparseVTable; impl SparseVTable { diff --git a/encodings/zigzag/src/array.rs b/encodings/zigzag/src/array.rs index 319c7e2616d..682c84959b6 100644 --- a/encodings/zigzag/src/array.rs +++ b/encodings/zigzag/src/array.rs @@ -18,6 +18,7 @@ use vortex_array::match_each_unsigned_integer_ptype; use vortex_array::scalar::Scalar; use vortex_array::serde::ArrayChildren; use vortex_array::stats::ArrayStats; +use vortex_array::stats::HasArrayStats; use vortex_array::stats::StatsSetRef; use vortex_array::vtable; use vortex_array::vtable::ArrayId; @@ -177,7 +178,13 @@ pub struct ZigZagArray { stats_set: ArrayStats, } -#[derive(Debug)] +impl HasArrayStats for ZigZagArray { + fn array_stats(&self) -> &ArrayStats { + &self.stats_set + } +} + +#[derive(Clone, Debug)] pub struct ZigZagVTable; impl ZigZagVTable { diff --git a/encodings/zstd/src/array.rs b/encodings/zstd/src/array.rs index 88c9c97c657..1f7024b55ab 100644 --- a/encodings/zstd/src/array.rs +++ b/encodings/zstd/src/array.rs @@ -27,6 +27,7 @@ use vortex_array::dtype::DType; use vortex_array::scalar::Scalar; use vortex_array::serde::ArrayChildren; use vortex_array::stats::ArrayStats; +use vortex_array::stats::HasArrayStats; use vortex_array::stats::StatsSetRef; use vortex_array::validity::Validity; use vortex_array::vtable; @@ -284,7 +285,13 @@ impl VTable for ZstdVTable { } } -#[derive(Debug)] +impl HasArrayStats for ZstdArray { + fn array_stats(&self) -> &ArrayStats { + &self.stats_set + } +} + +#[derive(Clone, Debug)] pub struct ZstdVTable; impl ZstdVTable { diff --git a/encodings/zstd/src/zstd_buffers.rs b/encodings/zstd/src/zstd_buffers.rs index 30c26bbf30a..3c742504f49 100644 --- a/encodings/zstd/src/zstd_buffers.rs +++ b/encodings/zstd/src/zstd_buffers.rs @@ -18,6 +18,7 @@ use vortex_array::scalar::Scalar; use vortex_array::serde::ArrayChildren; use vortex_array::session::ArraySessionExt; use vortex_array::stats::ArrayStats; +use vortex_array::stats::HasArrayStats; use vortex_array::stats::StatsSetRef; use vortex_array::vtable; use vortex_array::vtable::ArrayId; @@ -36,7 +37,7 @@ use crate::ZstdBuffersMetadata; vtable!(ZstdBuffers); -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct ZstdBuffersVTable; impl ZstdBuffersVTable { @@ -61,6 +62,12 @@ pub struct ZstdBuffersArray { stats_set: ArrayStats, } +impl HasArrayStats for ZstdBuffersArray { + fn array_stats(&self) -> &ArrayStats { + &self.stats_set + } +} + #[derive(Clone, Debug)] pub struct ZstdBuffersDecodePlan { compressed_buffers: Vec, diff --git a/vortex-array/src/array/mod.rs b/vortex-array/src/array/mod.rs index b9dca3c8da9..9484c8bdb4c 100644 --- a/vortex-array/src/array/mod.rs +++ b/vortex-array/src/array/mod.rs @@ -5,8 +5,6 @@ mod visitor; pub use visitor::*; mod typed; -pub use typed::*; - use std::any::Any; use std::fmt::Debug; use std::fmt::Formatter; @@ -16,6 +14,7 @@ use std::ops::Deref; use std::ops::Range; use std::sync::Arc; +pub use typed::*; use vortex_buffer::ByteBuffer; use vortex_error::VortexExpect; use vortex_error::VortexResult; @@ -312,10 +311,20 @@ impl dyn DynArray + '_ { /// Returns the array downcast to the given `A` as an owned object. pub fn try_into(self: Arc) -> Result> { - match self.is::() { - true => { - let arc = self - .as_any_arc() + if !self.is::() { + return Err(self); + } + + // Try Array first (the primary construction path via IntoArray). + let any_arc = self.as_any_arc(); + match any_arc.downcast::>() { + Ok(arc) => Ok(match Arc::try_unwrap(arc) { + Ok(array) => array.data, + Err(arc) => arc.data.clone(), + }), + Err(any_arc) => { + // Fall back to ArrayAdapter (stack-local Deref path). + let arc = any_arc .downcast::>() .map_err(|_| vortex_err!("failed to downcast")) .vortex_expect("Failed to downcast"); @@ -324,7 +333,6 @@ impl dyn DynArray + '_ { Err(arc) => arc.deref().0.clone(), }) } - false => Err(self), } } @@ -748,12 +756,15 @@ impl Matcher for V { type Match<'a> = &'a V::Array; fn matches(array: &dyn DynArray) -> bool { - DynArray::as_any(array).is::>() + let any = DynArray::as_any(array); + any.is::>() || any.is::>() } fn try_match<'a>(array: &'a dyn DynArray) -> Option> { - DynArray::as_any(array) - .downcast_ref::>() - .map(|array_adapter| &array_adapter.0) + let any = DynArray::as_any(array); + any.downcast_ref::>().map(|a| &a.data).or_else(|| { + any.downcast_ref::>() + .map(|array_adapter| &array_adapter.0) + }) } } diff --git a/vortex-array/src/array/typed.rs b/vortex-array/src/array/typed.rs index 74618d1985a..32e1bc60495 100644 --- a/vortex-array/src/array/typed.rs +++ b/vortex-array/src/array/typed.rs @@ -1,11 +1,62 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: Copyright the Vortex contributors +use std::any::Any; +use std::fmt::Debug; +use std::fmt::Formatter; +use std::hash::Hash; +use std::hash::Hasher; +use std::ops::Range; +use std::sync::Arc; + +use vortex_buffer::ByteBuffer; +use vortex_error::VortexExpect; +use vortex_error::VortexResult; +use vortex_error::vortex_ensure; +use vortex_error::vortex_err; +use vortex_error::vortex_panic; +use vortex_mask::Mask; + +use crate::ArrayEq; +use crate::ArrayHash; +use crate::ArrayRef; +use crate::Canonical; +use crate::DynArray; +use crate::ExecutionCtx; +use crate::IntoArray; +use crate::LEGACY_SESSION; +use crate::VortexSessionExecute; +use crate::array::ArrayVisitor; +use crate::array::visitor::ArrayVisitorExt; +use crate::arrays::ConstantVTable; +use crate::arrays::DictArray; +use crate::arrays::FilterArray; +use crate::arrays::ScalarFnVTable; +use crate::arrays::SliceArray; +use crate::buffer::BufferHandle; +use crate::builders::ArrayBuilder; +use crate::compute; use crate::dtype::DType; -use crate::stats::{ArrayStats, StatsSetRef}; +use crate::dtype::Nullability; +use crate::expr::stats::Precision; +use crate::expr::stats::Stat; +use crate::expr::stats::StatsProviderExt; +use crate::hash; +use crate::optimizer::ArrayOptimizer; +use crate::scalar::Scalar; +use crate::scalar_fn::ReduceNode; +use crate::scalar_fn::ReduceNodeRef; +use crate::scalar_fn::ScalarFnRef; +use crate::stats::ArrayStats; +use crate::stats::HasArrayStats; +use crate::stats::StatsSetRef; +use crate::validity::Validity; +use crate::vtable::ArrayId; +use crate::vtable::ArrayVTableExt; +use crate::vtable::DynVTable; +use crate::vtable::OperationsVTable; use crate::vtable::VTable; -use crate::ArrayRef; -use std::ops::Deref; +use crate::vtable::ValidityVTable; /// The typed representation of a Vortex array, pairing a vtable with its array data and other /// common fields. @@ -14,40 +65,392 @@ pub struct Array { vtable: V, len: usize, dtype: DType, - data: V::Array, + pub(crate) data: V::Array, child_slots: Vec>, stats: ArrayStats, } -/// Deref to the inner array data for convenient access to typed accessors. -impl Deref for Array { - type Target = V::Array; +impl Array { + /// Constructs a new `Array` by extracting common fields from the encoding struct. + pub fn new(vtable: V, data: V::Array) -> Self { + let len = V::len(&data); + let dtype = V::dtype(&data).clone(); + let stats = data.array_stats().clone(); + Self { + vtable, + len, + dtype, + data, + child_slots: Vec::new(), + stats, + } + } - fn deref(&self) -> &Self::Target { + /// Access the encoding-specific data. + pub fn data(&self) -> &V::Array { &self.data } -} -impl Array { - /// Returns the length of the array. + /// Returns the stats of the array. #[inline(always)] - pub fn len(&self) -> usize { - self.len + pub fn array_stats(&self) -> &ArrayStats { + &self.stats } +} - /// Returns whether the array is empty. - #[inline(always)] - pub fn is_empty(&self) -> bool { - self.len == 0 +impl ReduceNode for Array { + fn as_any(&self) -> &dyn Any { + self + } + + fn node_dtype(&self) -> VortexResult { + Ok(self.dtype.clone()) + } + + fn scalar_fn(&self) -> Option<&ScalarFnRef> { + self.data.as_opt::().map(|a| a.scalar_fn()) + } + + fn child(&self, idx: usize) -> ReduceNodeRef { + self.nth_child(idx) + .unwrap_or_else(|| vortex_panic!("Child index out of bounds: {}", idx)) + } + + fn child_count(&self) -> usize { + self.nchildren() + } +} + +impl DynArray for Array { + fn as_any(&self) -> &dyn Any { + self + } + + fn as_any_arc(self: Arc) -> Arc { + self + } + + fn to_array(&self) -> ArrayRef { + Arc::new(Self { + vtable: self.vtable.clone(), + len: self.len, + dtype: self.dtype.clone(), + data: self.data.clone(), + child_slots: self.child_slots.clone(), + stats: self.stats.clone(), + }) + } + + fn len(&self) -> usize { + self.len } - /// Returns the dtype of the array. - pub fn dtype(&self) -> &DType { + fn dtype(&self) -> &DType { &self.dtype } - /// Returns the stats of the array. - pub fn stats(&self) -> &ArrayStats { - &self.stats + fn vtable(&self) -> &dyn DynVTable { + V::vtable() + } + + fn encoding_id(&self) -> ArrayId { + V::id(&self.data) + } + + fn slice(&self, range: Range) -> VortexResult { + let start = range.start; + let stop = range.end; + + if start == 0 && stop == self.len() { + return Ok(self.to_array()); + } + + vortex_ensure!( + start <= self.len(), + "OutOfBounds: start {start} > length {}", + self.len() + ); + vortex_ensure!( + stop <= self.len(), + "OutOfBounds: stop {stop} > length {}", + self.len() + ); + + vortex_ensure!(start <= stop, "start ({start}) must be <= stop ({stop})"); + + if start == stop { + return Ok(Canonical::empty(self.dtype()).into_array()); + } + + let sliced = SliceArray::try_new(self.to_array(), range)? + .into_array() + .optimize()?; + + // Propagate some stats from the original array to the sliced array. + if !sliced.is::() { + self.statistics().with_iter(|iter| { + sliced.statistics().inherit(iter.filter(|(stat, value)| { + matches!( + stat, + Stat::IsConstant | Stat::IsSorted | Stat::IsStrictSorted + ) && value.as_ref().as_exact().is_some_and(|v| { + Scalar::try_new(DType::Bool(Nullability::NonNullable), Some(v.clone())) + .vortex_expect("A stat that was expected to be a boolean stat was not") + .as_bool() + .value() + .unwrap_or_default() + }) + })); + }); + } + + Ok(sliced) + } + + fn filter(&self, mask: Mask) -> VortexResult { + FilterArray::try_new(self.to_array(), mask)? + .into_array() + .optimize() + } + + fn take(&self, indices: ArrayRef) -> VortexResult { + DictArray::try_new(indices, self.to_array())? + .into_array() + .optimize() + } + + fn scalar_at(&self, index: usize) -> VortexResult { + vortex_ensure!(index < self.len(), OutOfBounds: index, 0, self.len()); + if self.is_invalid(index)? { + return Ok(Scalar::null(self.dtype().clone())); + } + let scalar = >::scalar_at(&self.data, index)?; + vortex_ensure!(self.dtype() == scalar.dtype(), "Scalar dtype mismatch"); + Ok(scalar) + } + + fn is_valid(&self, index: usize) -> VortexResult { + vortex_ensure!(index < self.len(), OutOfBounds: index, 0, self.len()); + match self.validity()? { + Validity::NonNullable | Validity::AllValid => Ok(true), + Validity::AllInvalid => Ok(false), + Validity::Array(a) => a + .scalar_at(index)? + .as_bool() + .value() + .ok_or_else(|| vortex_err!("validity value at index {} is null", index)), + } + } + + fn is_invalid(&self, index: usize) -> VortexResult { + Ok(!self.is_valid(index)?) + } + + fn all_valid(&self) -> VortexResult { + match self.validity()? { + Validity::NonNullable | Validity::AllValid => Ok(true), + Validity::AllInvalid => Ok(false), + Validity::Array(a) => Ok(a.statistics().compute_min::().unwrap_or(false)), + } + } + + fn all_invalid(&self) -> VortexResult { + match self.validity()? { + Validity::NonNullable | Validity::AllValid => Ok(false), + Validity::AllInvalid => Ok(true), + Validity::Array(a) => Ok(!a.statistics().compute_max::().unwrap_or(true)), + } + } + + fn valid_count(&self) -> VortexResult { + if let Some(Precision::Exact(invalid_count)) = + self.statistics().get_as::(Stat::NullCount) + { + return Ok(self.len() - invalid_count); + } + + let count = match self.validity()? { + Validity::NonNullable | Validity::AllValid => self.len(), + Validity::AllInvalid => 0, + Validity::Array(a) => { + let sum = compute::sum(&a)?; + sum.as_primitive() + .as_::() + .ok_or_else(|| vortex_err!("sum of validity array is null"))? + } + }; + vortex_ensure!(count <= self.len(), "Valid count exceeds array length"); + + self.statistics() + .set(Stat::NullCount, Precision::exact(self.len() - count)); + + Ok(count) + } + + fn invalid_count(&self) -> VortexResult { + Ok(self.len() - self.valid_count()?) + } + + fn validity(&self) -> VortexResult { + if self.dtype().is_nullable() { + let validity = >::validity(&self.data)?; + if let Validity::Array(array) = &validity { + vortex_ensure!(array.len() == self.len(), "Validity array length mismatch"); + vortex_ensure!( + matches!(array.dtype(), DType::Bool(Nullability::NonNullable)), + "Validity array is not non-nullable boolean: {}", + self.encoding_id(), + ); + } + Ok(validity) + } else { + Ok(Validity::NonNullable) + } + } + + fn validity_mask(&self) -> VortexResult { + match self.validity()? { + Validity::NonNullable | Validity::AllValid => Ok(Mask::new_true(self.len())), + Validity::AllInvalid => Ok(Mask::new_false(self.len())), + Validity::Array(a) => a.try_to_mask_fill_null_false(), + } + } + + fn to_canonical(&self) -> VortexResult { + self.to_array() + .execute(&mut LEGACY_SESSION.create_execution_ctx()) + } + + fn append_to_builder( + &self, + builder: &mut dyn ArrayBuilder, + ctx: &mut ExecutionCtx, + ) -> VortexResult<()> { + if builder.dtype() != self.dtype() { + vortex_panic!( + "Builder dtype mismatch: expected {}, got {}", + self.dtype(), + builder.dtype(), + ); + } + let len = builder.len(); + + V::append_to_builder(&self.data, builder, ctx)?; + + assert_eq!( + len + self.len(), + builder.len(), + "Builder length mismatch after writing array for encoding {}", + self.encoding_id(), + ); + Ok(()) + } + + fn statistics(&self) -> StatsSetRef<'_> { + self.stats.to_ref(self) + } + + fn with_children(&self, children: Vec) -> VortexResult { + let mut data = self.data.clone(); + V::with_children(&mut data, children)?; + Ok(data.into_array()) + } +} + +impl ArrayHash for Array { + fn array_hash(&self, state: &mut H, precision: hash::Precision) { + self.data.encoding_id().hash(state); + V::array_hash(&self.data, state, precision); + } +} + +impl ArrayEq for Array { + fn array_eq(&self, other: &Self, precision: hash::Precision) -> bool { + V::array_eq(&self.data, &other.data, precision) + } +} + +impl ArrayVisitor for Array { + fn children(&self) -> Vec { + (0..V::nchildren(&self.data)) + .map(|i| V::child(&self.data, i)) + .collect() + } + + fn nchildren(&self) -> usize { + V::nchildren(&self.data) + } + + fn nth_child(&self, idx: usize) -> Option { + (idx < V::nchildren(&self.data)).then(|| V::child(&self.data, idx)) + } + + fn children_names(&self) -> Vec { + (0..V::nchildren(&self.data)) + .map(|i| V::child_name(&self.data, i)) + .collect() + } + + fn named_children(&self) -> Vec<(String, ArrayRef)> { + (0..V::nchildren(&self.data)) + .map(|i| (V::child_name(&self.data, i), V::child(&self.data, i))) + .collect() + } + + fn buffers(&self) -> Vec { + (0..V::nbuffers(&self.data)) + .map(|i| V::buffer(&self.data, i).to_host_sync()) + .collect() + } + + fn buffer_handles(&self) -> Vec { + (0..V::nbuffers(&self.data)) + .map(|i| V::buffer(&self.data, i)) + .collect() + } + + fn buffer_names(&self) -> Vec { + (0..V::nbuffers(&self.data)) + .filter_map(|i| V::buffer_name(&self.data, i)) + .collect() + } + + fn named_buffers(&self) -> Vec<(String, BufferHandle)> { + (0..V::nbuffers(&self.data)) + .filter_map(|i| { + V::buffer_name(&self.data, i).map(|name| (name, V::buffer(&self.data, i))) + }) + .collect() + } + + fn nbuffers(&self) -> usize { + V::nbuffers(&self.data) + } + + fn metadata(&self) -> VortexResult>> { + V::serialize(V::metadata(&self.data)?) + } + + fn metadata_fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + match V::metadata(&self.data) { + Err(e) => write!(f, ""), + Ok(metadata) => Debug::fmt(&metadata, f), + } + } + + fn is_host(&self) -> bool { + for array in self.depth_first_traversal() { + if !array.buffer_handles().iter().all(BufferHandle::is_on_host) { + return false; + } + } + + true + } +} + +impl IntoArray for Array { + fn into_array(self) -> ArrayRef { + Arc::new(self) } } diff --git a/vortex-array/src/arrays/bool/array.rs b/vortex-array/src/arrays/bool/array.rs index 124aa3f2427..f34996f2813 100644 --- a/vortex-array/src/arrays/bool/array.rs +++ b/vortex-array/src/arrays/bool/array.rs @@ -15,6 +15,7 @@ use crate::arrays::bool; use crate::buffer::BufferHandle; use crate::dtype::DType; use crate::stats::ArrayStats; +use crate::stats::HasArrayStats; use crate::validity::Validity; /// A boolean array that stores true/false values in a compact bit-packed format. @@ -59,6 +60,12 @@ pub struct BoolArray { pub(super) stats_set: ArrayStats, } +impl HasArrayStats for BoolArray { + fn array_stats(&self) -> &ArrayStats { + &self.stats_set + } +} + pub struct BoolArrayParts { pub bits: BufferHandle, pub offset: usize, diff --git a/vortex-array/src/arrays/bool/vtable/mod.rs b/vortex-array/src/arrays/bool/vtable/mod.rs index f935f89236c..d5a4799e477 100644 --- a/vortex-array/src/arrays/bool/vtable/mod.rs +++ b/vortex-array/src/arrays/bool/vtable/mod.rs @@ -206,7 +206,7 @@ impl VTable for BoolVTable { } } -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct BoolVTable; impl BoolVTable { diff --git a/vortex-array/src/arrays/chunked/array.rs b/vortex-array/src/arrays/chunked/array.rs index 12a34adf4a4..2c790d5cd96 100644 --- a/vortex-array/src/arrays/chunked/array.rs +++ b/vortex-array/src/arrays/chunked/array.rs @@ -24,6 +24,7 @@ use crate::iter::ArrayIteratorAdapter; use crate::search_sorted::SearchSorted; use crate::search_sorted::SearchSortedSide; use crate::stats::ArrayStats; +use crate::stats::HasArrayStats; use crate::stream::ArrayStream; use crate::stream::ArrayStreamAdapter; use crate::validity::Validity; @@ -37,6 +38,12 @@ pub struct ChunkedArray { pub(super) stats_set: ArrayStats, } +impl HasArrayStats for ChunkedArray { + fn array_stats(&self) -> &ArrayStats { + &self.stats_set + } +} + impl ChunkedArray { /// Constructs a new `ChunkedArray`. /// diff --git a/vortex-array/src/arrays/chunked/vtable/mod.rs b/vortex-array/src/arrays/chunked/vtable/mod.rs index ab05f262563..57c1b4e32ab 100644 --- a/vortex-array/src/arrays/chunked/vtable/mod.rs +++ b/vortex-array/src/arrays/chunked/vtable/mod.rs @@ -41,7 +41,7 @@ mod operations; mod validity; vtable!(Chunked); -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct ChunkedVTable; impl ChunkedVTable { diff --git a/vortex-array/src/arrays/constant/array.rs b/vortex-array/src/arrays/constant/array.rs index e8bcb7d88c6..1894a4e7c4b 100644 --- a/vortex-array/src/arrays/constant/array.rs +++ b/vortex-array/src/arrays/constant/array.rs @@ -3,6 +3,7 @@ use crate::scalar::Scalar; use crate::stats::ArrayStats; +use crate::stats::HasArrayStats; #[derive(Clone, Debug)] pub struct ConstantArray { @@ -11,6 +12,12 @@ pub struct ConstantArray { pub(super) stats_set: ArrayStats, } +impl HasArrayStats for ConstantArray { + fn array_stats(&self) -> &ArrayStats { + &self.stats_set + } +} + impl ConstantArray { pub fn new(scalar: S, len: usize) -> Self where diff --git a/vortex-array/src/arrays/constant/vtable/mod.rs b/vortex-array/src/arrays/constant/vtable/mod.rs index 14017fd4044..a29c4cdcf31 100644 --- a/vortex-array/src/arrays/constant/vtable/mod.rs +++ b/vortex-array/src/arrays/constant/vtable/mod.rs @@ -43,7 +43,7 @@ mod validity; vtable!(Constant); -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct ConstantVTable; impl ConstantVTable { diff --git a/vortex-array/src/arrays/decimal/array.rs b/vortex-array/src/arrays/decimal/array.rs index 9f1be7e487a..37c6634daad 100644 --- a/vortex-array/src/arrays/decimal/array.rs +++ b/vortex-array/src/arrays/decimal/array.rs @@ -25,6 +25,7 @@ use crate::match_each_decimal_value_type; use crate::match_each_integer_ptype; use crate::patches::Patches; use crate::stats::ArrayStats; +use crate::stats::HasArrayStats; use crate::validity::Validity; use crate::vtable::ValidityHelper; @@ -94,6 +95,12 @@ pub struct DecimalArray { pub(super) stats_set: ArrayStats, } +impl HasArrayStats for DecimalArray { + fn array_stats(&self) -> &ArrayStats { + &self.stats_set + } +} + pub struct DecimalArrayParts { pub decimal_dtype: DecimalDType, pub values: BufferHandle, diff --git a/vortex-array/src/arrays/decimal/vtable/mod.rs b/vortex-array/src/arrays/decimal/vtable/mod.rs index 65cc99da536..0c6ed138f96 100644 --- a/vortex-array/src/arrays/decimal/vtable/mod.rs +++ b/vortex-array/src/arrays/decimal/vtable/mod.rs @@ -228,7 +228,7 @@ impl VTable for DecimalVTable { } } -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct DecimalVTable; impl DecimalVTable { diff --git a/vortex-array/src/arrays/dict/array.rs b/vortex-array/src/arrays/dict/array.rs index c8106243550..ab80c67e468 100644 --- a/vortex-array/src/arrays/dict/array.rs +++ b/vortex-array/src/arrays/dict/array.rs @@ -14,6 +14,7 @@ use crate::dtype::DType; use crate::dtype::PType; use crate::match_each_integer_ptype; use crate::stats::ArrayStats; +use crate::stats::HasArrayStats; #[derive(Clone, prost::Message)] pub struct DictMetadata { @@ -45,6 +46,12 @@ pub struct DictArray { pub(super) all_values_referenced: bool, } +impl HasArrayStats for DictArray { + fn array_stats(&self) -> &ArrayStats { + &self.stats_set + } +} + pub struct DictArrayParts { pub codes: ArrayRef, pub values: ArrayRef, diff --git a/vortex-array/src/arrays/dict/vtable/mod.rs b/vortex-array/src/arrays/dict/vtable/mod.rs index 6c6555b596a..4df769a4bfa 100644 --- a/vortex-array/src/arrays/dict/vtable/mod.rs +++ b/vortex-array/src/arrays/dict/vtable/mod.rs @@ -43,7 +43,7 @@ mod validity; vtable!(Dict); -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct DictVTable; impl DictVTable { diff --git a/vortex-array/src/arrays/extension/array.rs b/vortex-array/src/arrays/extension/array.rs index 8df5963a5e9..a5903a65de7 100644 --- a/vortex-array/src/arrays/extension/array.rs +++ b/vortex-array/src/arrays/extension/array.rs @@ -6,6 +6,7 @@ use crate::dtype::DType; use crate::dtype::extension::ExtDTypeRef; use crate::dtype::extension::ExtId; use crate::stats::ArrayStats; +use crate::stats::HasArrayStats; /// An extension array that wraps another array with additional type information. /// @@ -52,6 +53,12 @@ pub struct ExtensionArray { pub(super) stats_set: ArrayStats, } +impl HasArrayStats for ExtensionArray { + fn array_stats(&self) -> &ArrayStats { + &self.stats_set + } +} + impl ExtensionArray { pub fn new(ext_dtype: ExtDTypeRef, storage: ArrayRef) -> Self { assert_eq!( diff --git a/vortex-array/src/arrays/extension/vtable/mod.rs b/vortex-array/src/arrays/extension/vtable/mod.rs index ceab73b456f..93643adaf9f 100644 --- a/vortex-array/src/arrays/extension/vtable/mod.rs +++ b/vortex-array/src/arrays/extension/vtable/mod.rs @@ -171,7 +171,7 @@ impl VTable for ExtensionVTable { } } -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct ExtensionVTable; impl ExtensionVTable { diff --git a/vortex-array/src/arrays/filter/array.rs b/vortex-array/src/arrays/filter/array.rs index 40857487a65..51c887ad668 100644 --- a/vortex-array/src/arrays/filter/array.rs +++ b/vortex-array/src/arrays/filter/array.rs @@ -8,6 +8,7 @@ use vortex_mask::Mask; use crate::ArrayRef; use crate::stats::ArrayStats; +use crate::stats::HasArrayStats; /// Decomposed parts of the filter array. pub struct FilterArrayParts { @@ -34,6 +35,12 @@ pub struct FilterArray { pub(super) stats: ArrayStats, } +impl HasArrayStats for FilterArray { + fn array_stats(&self) -> &ArrayStats { + &self.stats + } +} + impl FilterArray { pub fn new(array: ArrayRef, mask: Mask) -> Self { Self::try_new(array, mask).vortex_expect("FilterArray construction failed") diff --git a/vortex-array/src/arrays/filter/vtable.rs b/vortex-array/src/arrays/filter/vtable.rs index 23b22612873..132419c7d98 100644 --- a/vortex-array/src/arrays/filter/vtable.rs +++ b/vortex-array/src/arrays/filter/vtable.rs @@ -39,7 +39,7 @@ use crate::vtable::ValidityVTable; vtable!(Filter); -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct FilterVTable; impl FilterVTable { diff --git a/vortex-array/src/arrays/fixed_size_list/array.rs b/vortex-array/src/arrays/fixed_size_list/array.rs index 12a9e044c11..e6590c2b31c 100644 --- a/vortex-array/src/arrays/fixed_size_list/array.rs +++ b/vortex-array/src/arrays/fixed_size_list/array.rs @@ -11,6 +11,7 @@ use crate::ArrayRef; use crate::DynArray; use crate::dtype::DType; use crate::stats::ArrayStats; +use crate::stats::HasArrayStats; use crate::validity::Validity; /// The canonical encoding for fixed-size list arrays. @@ -99,6 +100,12 @@ pub struct FixedSizeListArray { pub(super) stats_set: ArrayStats, } +impl HasArrayStats for FixedSizeListArray { + fn array_stats(&self) -> &ArrayStats { + &self.stats_set + } +} + impl FixedSizeListArray { /// Creates a new [`FixedSizeListArray`]. /// diff --git a/vortex-array/src/arrays/fixed_size_list/vtable/mod.rs b/vortex-array/src/arrays/fixed_size_list/vtable/mod.rs index 4544dd976a4..0c1d9046c4b 100644 --- a/vortex-array/src/arrays/fixed_size_list/vtable/mod.rs +++ b/vortex-array/src/arrays/fixed_size_list/vtable/mod.rs @@ -35,7 +35,7 @@ mod operations; mod validity; vtable!(FixedSizeList); -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct FixedSizeListVTable; impl FixedSizeListVTable { diff --git a/vortex-array/src/arrays/list/array.rs b/vortex-array/src/arrays/list/array.rs index cdca1ae04f2..999eeb038b3 100644 --- a/vortex-array/src/arrays/list/array.rs +++ b/vortex-array/src/arrays/list/array.rs @@ -24,6 +24,7 @@ use crate::match_each_integer_ptype; use crate::match_each_native_ptype; use crate::scalar_fn::fns::operators::Operator; use crate::stats::ArrayStats; +use crate::stats::HasArrayStats; use crate::validity::Validity; /// A list array that stores variable-length lists of elements, similar to `Vec>`. @@ -87,6 +88,12 @@ pub struct ListArray { pub(super) stats_set: ArrayStats, } +impl HasArrayStats for ListArray { + fn array_stats(&self) -> &ArrayStats { + &self.stats_set + } +} + pub struct ListArrayParts { pub dtype: DType, pub elements: ArrayRef, diff --git a/vortex-array/src/arrays/list/vtable/mod.rs b/vortex-array/src/arrays/list/vtable/mod.rs index 99c052565b2..0d15f66bd59 100644 --- a/vortex-array/src/arrays/list/vtable/mod.rs +++ b/vortex-array/src/arrays/list/vtable/mod.rs @@ -224,7 +224,7 @@ impl VTable for ListVTable { } } -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct ListVTable; impl ListVTable { diff --git a/vortex-array/src/arrays/listview/array.rs b/vortex-array/src/arrays/listview/array.rs index 2d43320bd95..03c165e4931 100644 --- a/vortex-array/src/arrays/listview/array.rs +++ b/vortex-array/src/arrays/listview/array.rs @@ -20,6 +20,7 @@ use crate::dtype::DType; use crate::dtype::IntegerPType; use crate::match_each_integer_ptype; use crate::stats::ArrayStats; +use crate::stats::HasArrayStats; use crate::validity::Validity; /// The canonical encoding for variable-length list arrays. @@ -127,6 +128,12 @@ pub struct ListViewArray { pub(super) stats_set: ArrayStats, } +impl HasArrayStats for ListViewArray { + fn array_stats(&self) -> &ArrayStats { + &self.stats_set + } +} + pub struct ListViewArrayParts { pub elements_dtype: Arc, diff --git a/vortex-array/src/arrays/listview/vtable/mod.rs b/vortex-array/src/arrays/listview/vtable/mod.rs index cbef285662e..9e183ca157a 100644 --- a/vortex-array/src/arrays/listview/vtable/mod.rs +++ b/vortex-array/src/arrays/listview/vtable/mod.rs @@ -38,7 +38,7 @@ mod operations; mod validity; vtable!(ListView); -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct ListViewVTable; impl ListViewVTable { diff --git a/vortex-array/src/arrays/masked/array.rs b/vortex-array/src/arrays/masked/array.rs index 38317caacd7..c5dc14de948 100644 --- a/vortex-array/src/arrays/masked/array.rs +++ b/vortex-array/src/arrays/masked/array.rs @@ -7,6 +7,7 @@ use vortex_error::vortex_bail; use crate::ArrayRef; use crate::dtype::DType; use crate::stats::ArrayStats; +use crate::stats::HasArrayStats; use crate::validity::Validity; #[derive(Clone, Debug)] @@ -17,6 +18,12 @@ pub struct MaskedArray { pub(super) stats: ArrayStats, } +impl HasArrayStats for MaskedArray { + fn array_stats(&self) -> &ArrayStats { + &self.stats + } +} + impl MaskedArray { pub fn try_new(child: ArrayRef, validity: Validity) -> VortexResult { if matches!(validity, Validity::NonNullable) { diff --git a/vortex-array/src/arrays/masked/vtable/mod.rs b/vortex-array/src/arrays/masked/vtable/mod.rs index 3ba48543c85..0cf02707a06 100644 --- a/vortex-array/src/arrays/masked/vtable/mod.rs +++ b/vortex-array/src/arrays/masked/vtable/mod.rs @@ -39,7 +39,7 @@ use crate::vtable::validity_nchildren; use crate::vtable::validity_to_child; vtable!(Masked); -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct MaskedVTable; impl MaskedVTable { diff --git a/vortex-array/src/arrays/null/mod.rs b/vortex-array/src/arrays/null/mod.rs index c3549fa9255..20236844c59 100644 --- a/vortex-array/src/arrays/null/mod.rs +++ b/vortex-array/src/arrays/null/mod.rs @@ -19,6 +19,7 @@ use crate::dtype::DType; use crate::scalar::Scalar; use crate::serde::ArrayChildren; use crate::stats::ArrayStats; +use crate::stats::HasArrayStats; use crate::stats::StatsSetRef; use crate::validity::Validity; use crate::vtable; @@ -169,7 +170,13 @@ pub struct NullArray { stats_set: ArrayStats, } -#[derive(Debug)] +impl HasArrayStats for NullArray { + fn array_stats(&self) -> &ArrayStats { + &self.stats_set + } +} + +#[derive(Clone, Debug)] pub struct NullVTable; impl NullVTable { diff --git a/vortex-array/src/arrays/primitive/array/mod.rs b/vortex-array/src/arrays/primitive/array/mod.rs index 37c9b475800..017e574b04d 100644 --- a/vortex-array/src/arrays/primitive/array/mod.rs +++ b/vortex-array/src/arrays/primitive/array/mod.rs @@ -19,6 +19,7 @@ use crate::dtype::Nullability; use crate::dtype::PType; use crate::match_each_native_ptype; use crate::stats::ArrayStats; +use crate::stats::HasArrayStats; use crate::validity::Validity; use crate::vtable::ValidityHelper; @@ -76,6 +77,12 @@ pub struct PrimitiveArray { pub(super) stats_set: ArrayStats, } +impl HasArrayStats for PrimitiveArray { + fn array_stats(&self) -> &ArrayStats { + &self.stats_set + } +} + pub struct PrimitiveArrayParts { pub ptype: PType, pub buffer: BufferHandle, diff --git a/vortex-array/src/arrays/primitive/vtable/mod.rs b/vortex-array/src/arrays/primitive/vtable/mod.rs index 479d05bb2d2..ef1a795e7e9 100644 --- a/vortex-array/src/arrays/primitive/vtable/mod.rs +++ b/vortex-array/src/arrays/primitive/vtable/mod.rs @@ -220,7 +220,7 @@ impl VTable for PrimitiveVTable { } } -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct PrimitiveVTable; impl PrimitiveVTable { diff --git a/vortex-array/src/arrays/scalar_fn/array.rs b/vortex-array/src/arrays/scalar_fn/array.rs index 1e3ef1d14ba..edcc273ddc6 100644 --- a/vortex-array/src/arrays/scalar_fn/array.rs +++ b/vortex-array/src/arrays/scalar_fn/array.rs @@ -9,6 +9,7 @@ use crate::DynArray; use crate::dtype::DType; use crate::scalar_fn::ScalarFnRef; use crate::stats::ArrayStats; +use crate::stats::HasArrayStats; #[derive(Clone, Debug)] pub struct ScalarFnArray { @@ -19,6 +20,12 @@ pub struct ScalarFnArray { pub(super) stats: ArrayStats, } +impl HasArrayStats for ScalarFnArray { + fn array_stats(&self) -> &ArrayStats { + &self.stats + } +} + impl ScalarFnArray { /// Create a new ScalarFnArray from a scalar function and its children. pub fn try_new(bound: ScalarFnRef, children: Vec, len: usize) -> VortexResult { diff --git a/vortex-array/src/arrays/shared/array.rs b/vortex-array/src/arrays/shared/array.rs index c69ae39395d..768b08f6f7a 100644 --- a/vortex-array/src/arrays/shared/array.rs +++ b/vortex-array/src/arrays/shared/array.rs @@ -14,6 +14,7 @@ use crate::Canonical; use crate::IntoArray; use crate::dtype::DType; use crate::stats::ArrayStats; +use crate::stats::HasArrayStats; /// A lazily-executing array wrapper with a one-way transition from source to cached form. /// @@ -28,6 +29,12 @@ pub struct SharedArray { pub(super) stats: ArrayStats, } +impl HasArrayStats for SharedArray { + fn array_stats(&self) -> &ArrayStats { + &self.stats + } +} + impl SharedArray { pub fn new(source: ArrayRef) -> Self { Self { diff --git a/vortex-array/src/arrays/shared/vtable.rs b/vortex-array/src/arrays/shared/vtable.rs index d79ca3de4d6..1e17cd669da 100644 --- a/vortex-array/src/arrays/shared/vtable.rs +++ b/vortex-array/src/arrays/shared/vtable.rs @@ -31,7 +31,7 @@ vtable!(Shared); // TODO(ngates): consider hooking Shared into the iterative execution model. Cache either the // most executed, or after each iteration, and return a shared cache for each execution. -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct SharedVTable; impl SharedVTable { diff --git a/vortex-array/src/arrays/slice/array.rs b/vortex-array/src/arrays/slice/array.rs index 8a0dbbb642c..d3b93be1f1f 100644 --- a/vortex-array/src/arrays/slice/array.rs +++ b/vortex-array/src/arrays/slice/array.rs @@ -9,6 +9,7 @@ use vortex_error::vortex_panic; use crate::ArrayRef; use crate::stats::ArrayStats; +use crate::stats::HasArrayStats; #[derive(Clone, Debug)] pub struct SliceArray { @@ -17,6 +18,12 @@ pub struct SliceArray { pub(super) stats: ArrayStats, } +impl HasArrayStats for SliceArray { + fn array_stats(&self) -> &ArrayStats { + &self.stats + } +} + pub struct SliceArrayParts { pub child: ArrayRef, pub range: Range, diff --git a/vortex-array/src/arrays/slice/vtable.rs b/vortex-array/src/arrays/slice/vtable.rs index f90392f0dbb..967f54e9e0f 100644 --- a/vortex-array/src/arrays/slice/vtable.rs +++ b/vortex-array/src/arrays/slice/vtable.rs @@ -38,7 +38,7 @@ use crate::vtable::ValidityVTable; vtable!(Slice); -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct SliceVTable; impl SliceVTable { diff --git a/vortex-array/src/arrays/struct_/array.rs b/vortex-array/src/arrays/struct_/array.rs index a351cc84a5d..c33de26ac74 100644 --- a/vortex-array/src/arrays/struct_/array.rs +++ b/vortex-array/src/arrays/struct_/array.rs @@ -18,6 +18,7 @@ use crate::dtype::FieldName; use crate::dtype::FieldNames; use crate::dtype::StructFields; use crate::stats::ArrayStats; +use crate::stats::HasArrayStats; use crate::validity::Validity; use crate::vtable::ValidityHelper; @@ -148,6 +149,12 @@ pub struct StructArray { pub(super) stats_set: ArrayStats, } +impl HasArrayStats for StructArray { + fn array_stats(&self) -> &ArrayStats { + &self.stats_set + } +} + pub struct StructArrayParts { pub struct_fields: StructFields, pub fields: Arc<[ArrayRef]>, diff --git a/vortex-array/src/arrays/struct_/vtable/mod.rs b/vortex-array/src/arrays/struct_/vtable/mod.rs index ca9f622b83d..eb7e364a380 100644 --- a/vortex-array/src/arrays/struct_/vtable/mod.rs +++ b/vortex-array/src/arrays/struct_/vtable/mod.rs @@ -228,7 +228,7 @@ impl VTable for StructVTable { } } -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct StructVTable; impl StructVTable { diff --git a/vortex-array/src/arrays/varbin/array.rs b/vortex-array/src/arrays/varbin/array.rs index 9c72e80487d..eee45e29c7d 100644 --- a/vortex-array/src/arrays/varbin/array.rs +++ b/vortex-array/src/arrays/varbin/array.rs @@ -18,6 +18,7 @@ use crate::dtype::IntegerPType; use crate::dtype::Nullability; use crate::match_each_integer_ptype; use crate::stats::ArrayStats; +use crate::stats::HasArrayStats; use crate::validity::Validity; #[derive(Clone, Debug)] @@ -29,6 +30,12 @@ pub struct VarBinArray { pub(super) stats_set: ArrayStats, } +impl HasArrayStats for VarBinArray { + fn array_stats(&self) -> &ArrayStats { + &self.stats_set + } +} + impl VarBinArray { /// Creates a new [`VarBinArray`]. /// diff --git a/vortex-array/src/arrays/varbin/vtable/mod.rs b/vortex-array/src/arrays/varbin/vtable/mod.rs index 9b3d3a1ec71..782636f6db7 100644 --- a/vortex-array/src/arrays/varbin/vtable/mod.rs +++ b/vortex-array/src/arrays/varbin/vtable/mod.rs @@ -223,7 +223,7 @@ impl VTable for VarBinVTable { } } -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct VarBinVTable; impl VarBinVTable { diff --git a/vortex-array/src/arrays/varbinview/array.rs b/vortex-array/src/arrays/varbinview/array.rs index 97377fa972e..504b9aa2c32 100644 --- a/vortex-array/src/arrays/varbinview/array.rs +++ b/vortex-array/src/arrays/varbinview/array.rs @@ -20,6 +20,7 @@ use crate::builders::VarBinViewBuilder; use crate::dtype::DType; use crate::dtype::Nullability; use crate::stats::ArrayStats; +use crate::stats::HasArrayStats; use crate::validity::Validity; /// A variable-length binary view array that stores strings and binary data efficiently. @@ -90,6 +91,12 @@ pub struct VarBinViewArray { pub(super) stats_set: ArrayStats, } +impl HasArrayStats for VarBinViewArray { + fn array_stats(&self) -> &ArrayStats { + &self.stats_set + } +} + pub struct VarBinViewArrayParts { pub dtype: DType, pub buffers: Arc<[BufferHandle]>, diff --git a/vortex-array/src/arrays/varbinview/vtable/mod.rs b/vortex-array/src/arrays/varbinview/vtable/mod.rs index ea958acca37..ad0c246d062 100644 --- a/vortex-array/src/arrays/varbinview/vtable/mod.rs +++ b/vortex-array/src/arrays/varbinview/vtable/mod.rs @@ -40,7 +40,7 @@ mod operations; mod validity; vtable!(VarBinView); -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct VarBinViewVTable; impl VarBinViewVTable { diff --git a/vortex-array/src/stats/array.rs b/vortex-array/src/stats/array.rs index 8220a5a2deb..b1c20c4f784 100644 --- a/vortex-array/src/stats/array.rs +++ b/vortex-array/src/stats/array.rs @@ -3,6 +3,7 @@ //! Stats as they are stored on arrays. +use std::fmt::Debug; use std::sync::Arc; use parking_lot::RwLock; @@ -36,6 +37,12 @@ pub struct ArrayStats { inner: Arc>, } +/// Trait for array types that provide access to their [`ArrayStats`]. +pub trait HasArrayStats: Debug { + /// Returns a reference to the array's stats. + fn array_stats(&self) -> &ArrayStats; +} + /// Reference to an array's [`StatsSet`]. Can be used to get and mutate the underlying stats. /// /// Constructed by calling [`ArrayStats::to_ref`]. diff --git a/vortex-array/src/vtable/dyn_.rs b/vortex-array/src/vtable/dyn_.rs index 4b3bad9223a..affee9e0efd 100644 --- a/vortex-array/src/vtable/dyn_.rs +++ b/vortex-array/src/vtable/dyn_.rs @@ -13,6 +13,7 @@ use vortex_error::VortexResult; use vortex_error::vortex_ensure; use vortex_session::VortexSession; +use crate::Array; use crate::ArrayAdapter; use crate::ArrayRef; use crate::DynArray; @@ -197,11 +198,11 @@ impl DynVTable for ArrayVTableAdapter { } fn downcast(array: &ArrayRef) -> &V::Array { - array - .as_any() - .downcast_ref::>() + let any = array.as_any(); + any.downcast_ref::>() + .map(|a| &a.data) + .or_else(|| any.downcast_ref::>().map(|a| a.as_inner())) .vortex_expect("Failed to downcast array to expected encoding type") - .as_inner() } impl Debug for ArrayVTableAdapter { diff --git a/vortex-array/src/vtable/mod.rs b/vortex-array/src/vtable/mod.rs index b8b20c04760..5d1096d975a 100644 --- a/vortex-array/src/vtable/mod.rs +++ b/vortex-array/src/vtable/mod.rs @@ -31,6 +31,7 @@ use crate::dtype::DType; use crate::executor::ExecutionCtx; use crate::patches::Patches; use crate::serde::ArrayChildren; +use crate::stats::HasArrayStats; use crate::stats::StatsSetRef; use crate::validity::Validity; @@ -47,8 +48,15 @@ use crate::validity::Validity; /// implementations so do not need to be checked in the vtable implementations (for example, index /// out of bounds). Post-conditions are validated after invocation of the vtable function and will /// panic if violated. -pub trait VTable: 'static + Sized + Send + Sync + Debug { - type Array: 'static + Send + Sync + Clone + Debug + Deref + IntoArray; +pub trait VTable: 'static + Sized + Send + Sync + Clone + Debug { + type Array: 'static + + Send + + Sync + + Clone + + Debug + + Deref + + IntoArray + + HasArrayStats; type Metadata: Debug; type OperationsVTable: OperationsVTable; @@ -328,8 +336,7 @@ macro_rules! vtable { impl $crate::IntoArray for [<$V Array>] { fn into_array(self) -> $crate::ArrayRef { - // We can unsafe transmute ourselves to an ArrayAdapter. - std::sync::Arc::new(unsafe { std::mem::transmute::<[<$V Array>], $crate::ArrayAdapter::<[<$V VTable>]>>(self) }) + std::sync::Arc::new($crate::Array::new([<$V VTable>], self)) } } diff --git a/vortex-python/src/arrays/py/array.rs b/vortex-python/src/arrays/py/array.rs index 48d623efa4d..59f63db4744 100644 --- a/vortex-python/src/arrays/py/array.rs +++ b/vortex-python/src/arrays/py/array.rs @@ -9,6 +9,7 @@ use pyo3::Py; use pyo3::PyAny; use pyo3::prelude::*; use vortex::array::stats::ArrayStats; +use vortex::array::stats::HasArrayStats; use vortex::array::vtable::ArrayId; use vortex::dtype::DType; @@ -28,6 +29,12 @@ pub struct PythonArray { pub(super) stats: ArrayStats, } +impl HasArrayStats for PythonArray { + fn array_stats(&self) -> &ArrayStats { + &self.stats + } +} + impl<'py> FromPyObject<'_, 'py> for PythonArray { type Error = PyErr; diff --git a/vortex-python/src/arrays/py/vtable.rs b/vortex-python/src/arrays/py/vtable.rs index 83ebfa226cf..d5c0e8e7aa0 100644 --- a/vortex-python/src/arrays/py/vtable.rs +++ b/vortex-python/src/arrays/py/vtable.rs @@ -35,7 +35,7 @@ use crate::arrays::py::PythonArray; vtable!(Python); /// Wrapper struct encapsulating a Python encoding. -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct PythonVTable; impl VTable for PythonVTable { From d9bc240ee87c2efb37b300381068c5da2cd8eaf8 Mon Sep 17 00:00:00 2001 From: Nicholas Gates Date: Tue, 3 Mar 2026 11:29:45 -0500 Subject: [PATCH 3/5] Slots Signed-off-by: Nicholas Gates --- vortex-array/src/array/typed.rs | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/vortex-array/src/array/typed.rs b/vortex-array/src/array/typed.rs index 32e1bc60495..034ce7cbf4f 100644 --- a/vortex-array/src/array/typed.rs +++ b/vortex-array/src/array/typed.rs @@ -76,12 +76,15 @@ impl Array { let len = V::len(&data); let dtype = V::dtype(&data).clone(); let stats = data.array_stats().clone(); + let child_slots = (0..V::nchildren(&data)) + .map(|i| Some(V::child(&data, i))) + .collect(); Self { vtable, len, dtype, data, - child_slots: Vec::new(), + child_slots, stats, } } @@ -372,28 +375,31 @@ impl ArrayEq for Array { impl ArrayVisitor for Array { fn children(&self) -> Vec { - (0..V::nchildren(&self.data)) - .map(|i| V::child(&self.data, i)) - .collect() + self.child_slots.iter().filter_map(|s| s.clone()).collect() } fn nchildren(&self) -> usize { - V::nchildren(&self.data) + self.child_slots.iter().filter(|s| s.is_some()).count() } fn nth_child(&self, idx: usize) -> Option { - (idx < V::nchildren(&self.data)).then(|| V::child(&self.data, idx)) + self.child_slots.get(idx).and_then(|s| s.clone()) } fn children_names(&self) -> Vec { - (0..V::nchildren(&self.data)) + (0..self.child_slots.len()) + .filter(|i| self.child_slots[*i].is_some()) .map(|i| V::child_name(&self.data, i)) .collect() } fn named_children(&self) -> Vec<(String, ArrayRef)> { - (0..V::nchildren(&self.data)) - .map(|i| (V::child_name(&self.data, i), V::child(&self.data, i))) + (0..self.child_slots.len()) + .filter_map(|i| { + self.child_slots[i] + .clone() + .map(|child| (V::child_name(&self.data, i), child)) + }) .collect() } From aeea6c233522f1a95a7c6579e9d522fa06620a54 Mon Sep 17 00:00:00 2001 From: Joe Isaacs Date: Fri, 6 Mar 2026 15:28:43 +0000 Subject: [PATCH 4/5] fix Signed-off-by: Joe Isaacs --- vortex-array/src/array/typed.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vortex-array/src/array/typed.rs b/vortex-array/src/array/typed.rs index 034ce7cbf4f..3d0baa7fb0a 100644 --- a/vortex-array/src/array/typed.rs +++ b/vortex-array/src/array/typed.rs @@ -315,7 +315,9 @@ impl DynArray for Array { match self.validity()? { Validity::NonNullable | Validity::AllValid => Ok(Mask::new_true(self.len())), Validity::AllInvalid => Ok(Mask::new_false(self.len())), - Validity::Array(a) => a.try_to_mask_fill_null_false(), + Validity::Array(a) => { + a.try_to_mask_fill_null_false(&mut LEGACY_SESSION.create_execution_ctx()) + } } } From 0bef3c25f9b22a6fd22120a8400532d8a2bd643a Mon Sep 17 00:00:00 2001 From: Joe Isaacs Date: Fri, 6 Mar 2026 15:43:36 +0000 Subject: [PATCH 5/5] fix: handle Array downcast in Python bindings and regenerate public API locks Signed-off-by: Joe Isaacs --- encodings/alp/public-api.lock | 16 + encodings/bytebool/public-api.lock | 8 + encodings/datetime-parts/public-api.lock | 8 + encodings/decimal-byte-parts/public-api.lock | 8 + encodings/fastlanes/public-api.lock | 32 ++ encodings/fsst/public-api.lock | 8 + encodings/pco/public-api.lock | 8 + encodings/runend/public-api.lock | 8 + encodings/sequence/public-api.lock | 8 + encodings/sparse/public-api.lock | 8 + encodings/zigzag/public-api.lock | 8 + encodings/zstd/public-api.lock | 8 + vortex-array/public-api.lock | 458 ++++++++++++++++++- vortex-python/src/arrays/native.rs | 15 +- 14 files changed, 593 insertions(+), 8 deletions(-) diff --git a/encodings/alp/public-api.lock b/encodings/alp/public-api.lock index 1671433c077..64505817f48 100644 --- a/encodings/alp/public-api.lock +++ b/encodings/alp/public-api.lock @@ -50,6 +50,10 @@ impl vortex_array::array::IntoArray for vortex_alp::ALPArray pub fn vortex_alp::ALPArray::into_array(self) -> vortex_array::array::ArrayRef +impl vortex_array::stats::array::HasArrayStats for vortex_alp::ALPArray + +pub fn vortex_alp::ALPArray::array_stats(&self) -> &vortex_array::stats::array::ArrayStats + pub struct vortex_alp::ALPMetadata impl core::clone::Clone for vortex_alp::ALPMetadata @@ -120,6 +124,10 @@ impl vortex_array::array::IntoArray for vortex_alp::ALPRDArray pub fn vortex_alp::ALPRDArray::into_array(self) -> vortex_array::array::ArrayRef +impl vortex_array::stats::array::HasArrayStats for vortex_alp::ALPRDArray + +pub fn vortex_alp::ALPRDArray::array_stats(&self) -> &vortex_array::stats::array::ArrayStats + pub struct vortex_alp::ALPRDMetadata impl vortex_alp::ALPRDMetadata @@ -152,6 +160,10 @@ impl vortex_alp::ALPRDVTable pub const vortex_alp::ALPRDVTable::ID: vortex_array::vtable::dyn_::ArrayId +impl core::clone::Clone for vortex_alp::ALPRDVTable + +pub fn vortex_alp::ALPRDVTable::clone(&self) -> vortex_alp::ALPRDVTable + impl core::fmt::Debug for vortex_alp::ALPRDVTable pub fn vortex_alp::ALPRDVTable::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result @@ -240,6 +252,10 @@ impl vortex_alp::ALPVTable pub const vortex_alp::ALPVTable::ID: vortex_array::vtable::dyn_::ArrayId +impl core::clone::Clone for vortex_alp::ALPVTable + +pub fn vortex_alp::ALPVTable::clone(&self) -> vortex_alp::ALPVTable + impl core::fmt::Debug for vortex_alp::ALPVTable pub fn vortex_alp::ALPVTable::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result diff --git a/encodings/bytebool/public-api.lock b/encodings/bytebool/public-api.lock index e0c7af3fa23..e9d224f71f6 100644 --- a/encodings/bytebool/public-api.lock +++ b/encodings/bytebool/public-api.lock @@ -50,6 +50,10 @@ impl vortex_array::array::IntoArray for vortex_bytebool::ByteBoolArray pub fn vortex_bytebool::ByteBoolArray::into_array(self) -> vortex_array::array::ArrayRef +impl vortex_array::stats::array::HasArrayStats for vortex_bytebool::ByteBoolArray + +pub fn vortex_bytebool::ByteBoolArray::array_stats(&self) -> &vortex_array::stats::array::ArrayStats + impl vortex_array::vtable::validity::ValidityHelper for vortex_bytebool::ByteBoolArray pub fn vortex_bytebool::ByteBoolArray::validity(&self) -> &vortex_array::validity::Validity @@ -60,6 +64,10 @@ impl vortex_bytebool::ByteBoolVTable pub const vortex_bytebool::ByteBoolVTable::ID: vortex_array::vtable::dyn_::ArrayId +impl core::clone::Clone for vortex_bytebool::ByteBoolVTable + +pub fn vortex_bytebool::ByteBoolVTable::clone(&self) -> vortex_bytebool::ByteBoolVTable + impl core::fmt::Debug for vortex_bytebool::ByteBoolVTable pub fn vortex_bytebool::ByteBoolVTable::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result diff --git a/encodings/datetime-parts/public-api.lock b/encodings/datetime-parts/public-api.lock index 854104c0dff..dfcf645603f 100644 --- a/encodings/datetime-parts/public-api.lock +++ b/encodings/datetime-parts/public-api.lock @@ -50,6 +50,10 @@ impl vortex_array::array::IntoArray for vortex_datetime_parts::DateTimePartsArra pub fn vortex_datetime_parts::DateTimePartsArray::into_array(self) -> vortex_array::array::ArrayRef +impl vortex_array::stats::array::HasArrayStats for vortex_datetime_parts::DateTimePartsArray + +pub fn vortex_datetime_parts::DateTimePartsArray::array_stats(&self) -> &vortex_array::stats::array::ArrayStats + pub struct vortex_datetime_parts::DateTimePartsArrayParts pub vortex_datetime_parts::DateTimePartsArrayParts::days: vortex_array::array::ArrayRef @@ -122,6 +126,10 @@ impl vortex_datetime_parts::DateTimePartsVTable pub const vortex_datetime_parts::DateTimePartsVTable::ID: vortex_array::vtable::dyn_::ArrayId +impl core::clone::Clone for vortex_datetime_parts::DateTimePartsVTable + +pub fn vortex_datetime_parts::DateTimePartsVTable::clone(&self) -> vortex_datetime_parts::DateTimePartsVTable + impl core::fmt::Debug for vortex_datetime_parts::DateTimePartsVTable pub fn vortex_datetime_parts::DateTimePartsVTable::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result diff --git a/encodings/decimal-byte-parts/public-api.lock b/encodings/decimal-byte-parts/public-api.lock index ec5485e15b2..f3025557c4e 100644 --- a/encodings/decimal-byte-parts/public-api.lock +++ b/encodings/decimal-byte-parts/public-api.lock @@ -40,6 +40,10 @@ impl vortex_array::array::IntoArray for vortex_decimal_byte_parts::DecimalBytePa pub fn vortex_decimal_byte_parts::DecimalBytePartsArray::into_array(self) -> vortex_array::array::ArrayRef +impl vortex_array::stats::array::HasArrayStats for vortex_decimal_byte_parts::DecimalBytePartsArray + +pub fn vortex_decimal_byte_parts::DecimalBytePartsArray::array_stats(&self) -> &vortex_array::stats::array::ArrayStats + pub struct vortex_decimal_byte_parts::DecimalBytePartsArrayParts pub vortex_decimal_byte_parts::DecimalBytePartsArrayParts::dtype: vortex_array::dtype::DType @@ -52,6 +56,10 @@ impl vortex_decimal_byte_parts::DecimalBytePartsVTable pub const vortex_decimal_byte_parts::DecimalBytePartsVTable::ID: vortex_array::vtable::dyn_::ArrayId +impl core::clone::Clone for vortex_decimal_byte_parts::DecimalBytePartsVTable + +pub fn vortex_decimal_byte_parts::DecimalBytePartsVTable::clone(&self) -> vortex_decimal_byte_parts::DecimalBytePartsVTable + impl core::fmt::Debug for vortex_decimal_byte_parts::DecimalBytePartsVTable pub fn vortex_decimal_byte_parts::DecimalBytePartsVTable::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result diff --git a/encodings/fastlanes/public-api.lock b/encodings/fastlanes/public-api.lock index 1baa7808e58..fcee96e601d 100644 --- a/encodings/fastlanes/public-api.lock +++ b/encodings/fastlanes/public-api.lock @@ -164,6 +164,10 @@ impl vortex_array::array::IntoArray for vortex_fastlanes::BitPackedArray pub fn vortex_fastlanes::BitPackedArray::into_array(self) -> vortex_array::array::ArrayRef +impl vortex_array::stats::array::HasArrayStats for vortex_fastlanes::BitPackedArray + +pub fn vortex_fastlanes::BitPackedArray::array_stats(&self) -> &vortex_array::stats::array::ArrayStats + impl vortex_array::vtable::validity::ValidityHelper for vortex_fastlanes::BitPackedArray pub fn vortex_fastlanes::BitPackedArray::validity(&self) -> &vortex_array::validity::Validity @@ -188,6 +192,10 @@ impl vortex_fastlanes::BitPackedVTable pub const vortex_fastlanes::BitPackedVTable::ID: vortex_array::vtable::dyn_::ArrayId +impl core::clone::Clone for vortex_fastlanes::BitPackedVTable + +pub fn vortex_fastlanes::BitPackedVTable::clone(&self) -> vortex_fastlanes::BitPackedVTable + impl core::fmt::Debug for vortex_fastlanes::BitPackedVTable pub fn vortex_fastlanes::BitPackedVTable::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result @@ -322,6 +330,10 @@ impl vortex_array::array::IntoArray for vortex_fastlanes::DeltaArray pub fn vortex_fastlanes::DeltaArray::into_array(self) -> vortex_array::array::ArrayRef +impl vortex_array::stats::array::HasArrayStats for vortex_fastlanes::DeltaArray + +pub fn vortex_fastlanes::DeltaArray::array_stats(&self) -> &vortex_array::stats::array::ArrayStats + impl vortex_array::vtable::validity::ValidityChildSliceHelper for vortex_fastlanes::DeltaArray pub fn vortex_fastlanes::DeltaArray::unsliced_child_and_slice(&self) -> (&vortex_array::array::ArrayRef, usize, usize) @@ -332,6 +344,10 @@ impl vortex_fastlanes::DeltaVTable pub const vortex_fastlanes::DeltaVTable::ID: vortex_array::vtable::dyn_::ArrayId +impl core::clone::Clone for vortex_fastlanes::DeltaVTable + +pub fn vortex_fastlanes::DeltaVTable::clone(&self) -> vortex_fastlanes::DeltaVTable + impl core::fmt::Debug for vortex_fastlanes::DeltaVTable pub fn vortex_fastlanes::DeltaVTable::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result @@ -442,12 +458,20 @@ impl vortex_array::array::IntoArray for vortex_fastlanes::FoRArray pub fn vortex_fastlanes::FoRArray::into_array(self) -> vortex_array::array::ArrayRef +impl vortex_array::stats::array::HasArrayStats for vortex_fastlanes::FoRArray + +pub fn vortex_fastlanes::FoRArray::array_stats(&self) -> &vortex_array::stats::array::ArrayStats + pub struct vortex_fastlanes::FoRVTable impl vortex_fastlanes::FoRVTable pub const vortex_fastlanes::FoRVTable::ID: vortex_array::vtable::dyn_::ArrayId +impl core::clone::Clone for vortex_fastlanes::FoRVTable + +pub fn vortex_fastlanes::FoRVTable::clone(&self) -> vortex_fastlanes::FoRVTable + impl core::fmt::Debug for vortex_fastlanes::FoRVTable pub fn vortex_fastlanes::FoRVTable::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result @@ -596,6 +620,10 @@ impl vortex_array::array::IntoArray for vortex_fastlanes::RLEArray pub fn vortex_fastlanes::RLEArray::into_array(self) -> vortex_array::array::ArrayRef +impl vortex_array::stats::array::HasArrayStats for vortex_fastlanes::RLEArray + +pub fn vortex_fastlanes::RLEArray::array_stats(&self) -> &vortex_array::stats::array::ArrayStats + impl vortex_array::vtable::validity::ValidityChildSliceHelper for vortex_fastlanes::RLEArray pub fn vortex_fastlanes::RLEArray::unsliced_child_and_slice(&self) -> (&vortex_array::array::ArrayRef, usize, usize) @@ -606,6 +634,10 @@ impl vortex_fastlanes::RLEVTable pub const vortex_fastlanes::RLEVTable::ID: vortex_array::vtable::dyn_::ArrayId +impl core::clone::Clone for vortex_fastlanes::RLEVTable + +pub fn vortex_fastlanes::RLEVTable::clone(&self) -> vortex_fastlanes::RLEVTable + impl core::fmt::Debug for vortex_fastlanes::RLEVTable pub fn vortex_fastlanes::RLEVTable::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result diff --git a/encodings/fsst/public-api.lock b/encodings/fsst/public-api.lock index 8451466972c..b2790e1c48c 100644 --- a/encodings/fsst/public-api.lock +++ b/encodings/fsst/public-api.lock @@ -52,6 +52,10 @@ impl vortex_array::array::IntoArray for vortex_fsst::FSSTArray pub fn vortex_fsst::FSSTArray::into_array(self) -> vortex_array::array::ArrayRef +impl vortex_array::stats::array::HasArrayStats for vortex_fsst::FSSTArray + +pub fn vortex_fsst::FSSTArray::array_stats(&self) -> &vortex_array::stats::array::ArrayStats + pub struct vortex_fsst::FSSTMetadata impl vortex_fsst::FSSTMetadata @@ -92,6 +96,10 @@ impl vortex_fsst::FSSTVTable pub const vortex_fsst::FSSTVTable::ID: vortex_array::vtable::dyn_::ArrayId +impl core::clone::Clone for vortex_fsst::FSSTVTable + +pub fn vortex_fsst::FSSTVTable::clone(&self) -> vortex_fsst::FSSTVTable + impl core::fmt::Debug for vortex_fsst::FSSTVTable pub fn vortex_fsst::FSSTVTable::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result diff --git a/encodings/pco/public-api.lock b/encodings/pco/public-api.lock index 599f0da1072..0e8d71cf372 100644 --- a/encodings/pco/public-api.lock +++ b/encodings/pco/public-api.lock @@ -42,6 +42,10 @@ impl vortex_array::array::IntoArray for vortex_pco::PcoArray pub fn vortex_pco::PcoArray::into_array(self) -> vortex_array::array::ArrayRef +impl vortex_array::stats::array::HasArrayStats for vortex_pco::PcoArray + +pub fn vortex_pco::PcoArray::array_stats(&self) -> &vortex_array::stats::array::ArrayStats + impl vortex_array::vtable::validity::ValiditySliceHelper for vortex_pco::PcoArray pub fn vortex_pco::PcoArray::unsliced_validity_and_slice(&self) -> (&vortex_array::validity::Validity, usize, usize) @@ -120,6 +124,10 @@ impl vortex_pco::PcoVTable pub const vortex_pco::PcoVTable::ID: vortex_array::vtable::dyn_::ArrayId +impl core::clone::Clone for vortex_pco::PcoVTable + +pub fn vortex_pco::PcoVTable::clone(&self) -> vortex_pco::PcoVTable + impl core::fmt::Debug for vortex_pco::PcoVTable pub fn vortex_pco::PcoVTable::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result diff --git a/encodings/runend/public-api.lock b/encodings/runend/public-api.lock index 49307599400..9a01f17414f 100644 --- a/encodings/runend/public-api.lock +++ b/encodings/runend/public-api.lock @@ -66,6 +66,10 @@ impl vortex_array::array::IntoArray for vortex_runend::RunEndArray pub fn vortex_runend::RunEndArray::into_array(self) -> vortex_array::array::ArrayRef +impl vortex_array::stats::array::HasArrayStats for vortex_runend::RunEndArray + +pub fn vortex_runend::RunEndArray::array_stats(&self) -> &vortex_array::stats::array::ArrayStats + impl vortex_array::arrow::FromArrowArray<&arrow_array::array::run_array::RunArray> for vortex_runend::RunEndArray where ::Native: vortex_array::dtype::ptype::NativePType pub fn vortex_runend::RunEndArray::from_arrow(array: &arrow_array::array::run_array::RunArray, nullable: bool) -> vortex_error::VortexResult @@ -114,6 +118,10 @@ impl vortex_runend::RunEndVTable pub const vortex_runend::RunEndVTable::ID: vortex_array::vtable::dyn_::ArrayId +impl core::clone::Clone for vortex_runend::RunEndVTable + +pub fn vortex_runend::RunEndVTable::clone(&self) -> vortex_runend::RunEndVTable + impl core::fmt::Debug for vortex_runend::RunEndVTable pub fn vortex_runend::RunEndVTable::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result diff --git a/encodings/sequence/public-api.lock b/encodings/sequence/public-api.lock index a48416a322a..dd5157f723f 100644 --- a/encodings/sequence/public-api.lock +++ b/encodings/sequence/public-api.lock @@ -48,6 +48,10 @@ impl vortex_array::array::IntoArray for vortex_sequence::SequenceArray pub fn vortex_sequence::SequenceArray::into_array(self) -> vortex_array::array::ArrayRef +impl vortex_array::stats::array::HasArrayStats for vortex_sequence::SequenceArray + +pub fn vortex_sequence::SequenceArray::array_stats(&self) -> &vortex_array::stats::array::ArrayStats + pub struct vortex_sequence::SequenceArrayParts pub vortex_sequence::SequenceArrayParts::base: vortex_array::scalar::typed_view::primitive::pvalue::PValue @@ -66,6 +70,10 @@ impl vortex_sequence::SequenceVTable pub const vortex_sequence::SequenceVTable::ID: vortex_array::vtable::dyn_::ArrayId +impl core::clone::Clone for vortex_sequence::SequenceVTable + +pub fn vortex_sequence::SequenceVTable::clone(&self) -> vortex_sequence::SequenceVTable + impl core::fmt::Debug for vortex_sequence::SequenceVTable pub fn vortex_sequence::SequenceVTable::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result diff --git a/encodings/sparse/public-api.lock b/encodings/sparse/public-api.lock index 5116e90a2ac..6d9058fa389 100644 --- a/encodings/sparse/public-api.lock +++ b/encodings/sparse/public-api.lock @@ -66,6 +66,10 @@ impl vortex_array::array::IntoArray for vortex_sparse::SparseArray pub fn vortex_sparse::SparseArray::into_array(self) -> vortex_array::array::ArrayRef +impl vortex_array::stats::array::HasArrayStats for vortex_sparse::SparseArray + +pub fn vortex_sparse::SparseArray::array_stats(&self) -> &vortex_array::stats::array::ArrayStats + pub struct vortex_sparse::SparseMetadata impl core::fmt::Debug for vortex_sparse::SparseMetadata @@ -78,6 +82,10 @@ impl vortex_sparse::SparseVTable pub const vortex_sparse::SparseVTable::ID: vortex_array::vtable::dyn_::ArrayId +impl core::clone::Clone for vortex_sparse::SparseVTable + +pub fn vortex_sparse::SparseVTable::clone(&self) -> vortex_sparse::SparseVTable + impl core::fmt::Debug for vortex_sparse::SparseVTable pub fn vortex_sparse::SparseVTable::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result diff --git a/encodings/zigzag/public-api.lock b/encodings/zigzag/public-api.lock index 4cdbcbdaf69..348677d5480 100644 --- a/encodings/zigzag/public-api.lock +++ b/encodings/zigzag/public-api.lock @@ -42,12 +42,20 @@ impl vortex_array::array::IntoArray for vortex_zigzag::ZigZagArray pub fn vortex_zigzag::ZigZagArray::into_array(self) -> vortex_array::array::ArrayRef +impl vortex_array::stats::array::HasArrayStats for vortex_zigzag::ZigZagArray + +pub fn vortex_zigzag::ZigZagArray::array_stats(&self) -> &vortex_array::stats::array::ArrayStats + pub struct vortex_zigzag::ZigZagVTable impl vortex_zigzag::ZigZagVTable pub const vortex_zigzag::ZigZagVTable::ID: vortex_array::vtable::dyn_::ArrayId +impl core::clone::Clone for vortex_zigzag::ZigZagVTable + +pub fn vortex_zigzag::ZigZagVTable::clone(&self) -> vortex_zigzag::ZigZagVTable + impl core::fmt::Debug for vortex_zigzag::ZigZagVTable pub fn vortex_zigzag::ZigZagVTable::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result diff --git a/encodings/zstd/public-api.lock b/encodings/zstd/public-api.lock index eeba254f97a..0b15cc391a5 100644 --- a/encodings/zstd/public-api.lock +++ b/encodings/zstd/public-api.lock @@ -52,6 +52,10 @@ impl vortex_array::array::IntoArray for vortex_zstd::ZstdArray pub fn vortex_zstd::ZstdArray::into_array(self) -> vortex_array::array::ArrayRef +impl vortex_array::stats::array::HasArrayStats for vortex_zstd::ZstdArray + +pub fn vortex_zstd::ZstdArray::array_stats(&self) -> &vortex_array::stats::array::ArrayStats + impl vortex_array::vtable::validity::ValiditySliceHelper for vortex_zstd::ZstdArray pub fn vortex_zstd::ZstdArray::unsliced_validity_and_slice(&self) -> (&vortex_array::validity::Validity, usize, usize) @@ -160,6 +164,10 @@ impl vortex_zstd::ZstdVTable pub const vortex_zstd::ZstdVTable::ID: vortex_array::vtable::dyn_::ArrayId +impl core::clone::Clone for vortex_zstd::ZstdVTable + +pub fn vortex_zstd::ZstdVTable::clone(&self) -> vortex_zstd::ZstdVTable + impl core::fmt::Debug for vortex_zstd::ZstdVTable pub fn vortex_zstd::ZstdVTable::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result diff --git a/vortex-array/public-api.lock b/vortex-array/public-api.lock index 6a78c7e3b27..11cd83abbee 100644 --- a/vortex-array/public-api.lock +++ b/vortex-array/public-api.lock @@ -128,6 +128,10 @@ impl vortex_array::arrays::DictVTable pub const vortex_array::arrays::DictVTable::ID: vortex_array::vtable::ArrayId +impl core::clone::Clone for vortex_array::arrays::DictVTable + +pub fn vortex_array::arrays::DictVTable::clone(&self) -> vortex_array::arrays::DictVTable + impl core::fmt::Debug for vortex_array::arrays::DictVTable pub fn vortex_array::arrays::DictVTable::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result @@ -402,6 +406,10 @@ impl vortex_array::IntoArray for vortex_array::arrays::BoolArray pub fn vortex_array::arrays::BoolArray::into_array(self) -> vortex_array::ArrayRef +impl vortex_array::stats::HasArrayStats for vortex_array::arrays::BoolArray + +pub fn vortex_array::arrays::BoolArray::array_stats(&self) -> &vortex_array::stats::ArrayStats + impl vortex_array::vtable::ValidityHelper for vortex_array::arrays::BoolArray pub fn vortex_array::arrays::BoolArray::validity(&self) -> &vortex_array::validity::Validity @@ -438,6 +446,10 @@ impl vortex_array::arrays::BoolVTable pub const vortex_array::arrays::BoolVTable::ID: vortex_array::vtable::ArrayId +impl core::clone::Clone for vortex_array::arrays::BoolVTable + +pub fn vortex_array::arrays::BoolVTable::clone(&self) -> vortex_array::arrays::BoolVTable + impl core::fmt::Debug for vortex_array::arrays::BoolVTable pub fn vortex_array::arrays::BoolVTable::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result @@ -608,12 +620,20 @@ impl vortex_array::IntoArray for vortex_array::arrays::ChunkedArray pub fn vortex_array::arrays::ChunkedArray::into_array(self) -> vortex_array::ArrayRef +impl vortex_array::stats::HasArrayStats for vortex_array::arrays::ChunkedArray + +pub fn vortex_array::arrays::ChunkedArray::array_stats(&self) -> &vortex_array::stats::ArrayStats + pub struct vortex_array::arrays::ChunkedVTable impl vortex_array::arrays::ChunkedVTable pub const vortex_array::arrays::ChunkedVTable::ID: vortex_array::vtable::ArrayId +impl core::clone::Clone for vortex_array::arrays::ChunkedVTable + +pub fn vortex_array::arrays::ChunkedVTable::clone(&self) -> vortex_array::arrays::ChunkedVTable + impl core::fmt::Debug for vortex_array::arrays::ChunkedVTable pub fn vortex_array::arrays::ChunkedVTable::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result @@ -766,6 +786,10 @@ impl vortex_array::IntoArray for vortex_array::arrays::ConstantArray pub fn vortex_array::arrays::ConstantArray::into_array(self) -> vortex_array::ArrayRef +impl vortex_array::stats::HasArrayStats for vortex_array::arrays::ConstantArray + +pub fn vortex_array::arrays::ConstantArray::array_stats(&self) -> &vortex_array::stats::ArrayStats + pub struct vortex_array::arrays::ConstantVTable impl vortex_array::arrays::ConstantVTable @@ -776,6 +800,10 @@ impl vortex_array::arrays::ConstantVTable pub const vortex_array::arrays::ConstantVTable::TAKE_RULES: vortex_array::optimizer::rules::ParentRuleSet +impl core::clone::Clone for vortex_array::arrays::ConstantVTable + +pub fn vortex_array::arrays::ConstantVTable::clone(&self) -> vortex_array::arrays::ConstantVTable + impl core::fmt::Debug for vortex_array::arrays::ConstantVTable pub fn vortex_array::arrays::ConstantVTable::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result @@ -950,6 +978,10 @@ impl vortex_array::IntoArray for vortex_array::arrays::DecimalArray pub fn vortex_array::arrays::DecimalArray::into_array(self) -> vortex_array::ArrayRef +impl vortex_array::stats::HasArrayStats for vortex_array::arrays::DecimalArray + +pub fn vortex_array::arrays::DecimalArray::array_stats(&self) -> &vortex_array::stats::ArrayStats + impl vortex_array::vtable::ValidityHelper for vortex_array::arrays::DecimalArray pub fn vortex_array::arrays::DecimalArray::validity(&self) -> &vortex_array::validity::Validity @@ -986,6 +1018,10 @@ impl vortex_array::arrays::DecimalVTable pub const vortex_array::arrays::DecimalVTable::ID: vortex_array::vtable::ArrayId +impl core::clone::Clone for vortex_array::arrays::DecimalVTable + +pub fn vortex_array::arrays::DecimalVTable::clone(&self) -> vortex_array::arrays::DecimalVTable + impl core::fmt::Debug for vortex_array::arrays::DecimalVTable pub fn vortex_array::arrays::DecimalVTable::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result @@ -1150,6 +1186,10 @@ impl vortex_array::IntoArray for vortex_array::arrays::DictArray pub fn vortex_array::arrays::DictArray::into_array(self) -> vortex_array::ArrayRef +impl vortex_array::stats::HasArrayStats for vortex_array::arrays::DictArray + +pub fn vortex_array::arrays::DictArray::array_stats(&self) -> &vortex_array::stats::ArrayStats + impl vortex_array::arrow::FromArrowArray<&arrow_array::array::dictionary_array::DictionaryArray> for vortex_array::arrays::DictArray pub fn vortex_array::arrays::DictArray::from_arrow(array: &arrow_array::array::dictionary_array::DictionaryArray, nullable: bool) -> vortex_error::VortexResult @@ -1198,6 +1238,10 @@ impl vortex_array::arrays::DictVTable pub const vortex_array::arrays::DictVTable::ID: vortex_array::vtable::ArrayId +impl core::clone::Clone for vortex_array::arrays::DictVTable + +pub fn vortex_array::arrays::DictVTable::clone(&self) -> vortex_array::arrays::DictVTable + impl core::fmt::Debug for vortex_array::arrays::DictVTable pub fn vortex_array::arrays::DictVTable::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result @@ -1388,12 +1432,20 @@ impl vortex_array::IntoArray for vortex_array::arrays::ExtensionArray pub fn vortex_array::arrays::ExtensionArray::into_array(self) -> vortex_array::ArrayRef +impl vortex_array::stats::HasArrayStats for vortex_array::arrays::ExtensionArray + +pub fn vortex_array::arrays::ExtensionArray::array_stats(&self) -> &vortex_array::stats::ArrayStats + pub struct vortex_array::arrays::ExtensionVTable impl vortex_array::arrays::ExtensionVTable pub const vortex_array::arrays::ExtensionVTable::ID: vortex_array::vtable::ArrayId +impl core::clone::Clone for vortex_array::arrays::ExtensionVTable + +pub fn vortex_array::arrays::ExtensionVTable::clone(&self) -> vortex_array::arrays::ExtensionVTable + impl core::fmt::Debug for vortex_array::arrays::ExtensionVTable pub fn vortex_array::arrays::ExtensionVTable::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result @@ -1546,6 +1598,10 @@ impl vortex_array::IntoArray for vortex_array::arrays::FilterArray pub fn vortex_array::arrays::FilterArray::into_array(self) -> vortex_array::ArrayRef +impl vortex_array::stats::HasArrayStats for vortex_array::arrays::FilterArray + +pub fn vortex_array::arrays::FilterArray::array_stats(&self) -> &vortex_array::stats::ArrayStats + pub struct vortex_array::arrays::FilterArrayParts pub vortex_array::arrays::FilterArrayParts::child: vortex_array::ArrayRef @@ -1590,6 +1646,10 @@ impl vortex_array::arrays::FilterVTable pub const vortex_array::arrays::FilterVTable::ID: vortex_array::vtable::ArrayId +impl core::clone::Clone for vortex_array::arrays::FilterVTable + +pub fn vortex_array::arrays::FilterVTable::clone(&self) -> vortex_array::arrays::FilterVTable + impl core::fmt::Debug for vortex_array::arrays::FilterVTable pub fn vortex_array::arrays::FilterVTable::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result @@ -1710,6 +1770,10 @@ impl vortex_array::IntoArray for vortex_array::arrays::FixedSizeListArray pub fn vortex_array::arrays::FixedSizeListArray::into_array(self) -> vortex_array::ArrayRef +impl vortex_array::stats::HasArrayStats for vortex_array::arrays::FixedSizeListArray + +pub fn vortex_array::arrays::FixedSizeListArray::array_stats(&self) -> &vortex_array::stats::ArrayStats + impl vortex_array::vtable::ValidityHelper for vortex_array::arrays::FixedSizeListArray pub fn vortex_array::arrays::FixedSizeListArray::validity(&self) -> &vortex_array::validity::Validity @@ -1720,6 +1784,10 @@ impl vortex_array::arrays::FixedSizeListVTable pub const vortex_array::arrays::FixedSizeListVTable::ID: vortex_array::vtable::ArrayId +impl core::clone::Clone for vortex_array::arrays::FixedSizeListVTable + +pub fn vortex_array::arrays::FixedSizeListVTable::clone(&self) -> vortex_array::arrays::FixedSizeListVTable + impl core::fmt::Debug for vortex_array::arrays::FixedSizeListVTable pub fn vortex_array::arrays::FixedSizeListVTable::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result @@ -1898,6 +1966,10 @@ impl vortex_array::IntoArray for vortex_array::arrays::ListArray pub fn vortex_array::arrays::ListArray::into_array(self) -> vortex_array::ArrayRef +impl vortex_array::stats::HasArrayStats for vortex_array::arrays::ListArray + +pub fn vortex_array::arrays::ListArray::array_stats(&self) -> &vortex_array::stats::ArrayStats + impl vortex_array::vtable::ValidityHelper for vortex_array::arrays::ListArray pub fn vortex_array::arrays::ListArray::validity(&self) -> &vortex_array::validity::Validity @@ -1918,6 +1990,10 @@ impl vortex_array::arrays::ListVTable pub const vortex_array::arrays::ListVTable::ID: vortex_array::vtable::ArrayId +impl core::clone::Clone for vortex_array::arrays::ListVTable + +pub fn vortex_array::arrays::ListVTable::clone(&self) -> vortex_array::arrays::ListVTable + impl core::fmt::Debug for vortex_array::arrays::ListVTable pub fn vortex_array::arrays::ListVTable::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result @@ -2084,6 +2160,10 @@ impl vortex_array::IntoArray for vortex_array::arrays::ListViewArray pub fn vortex_array::arrays::ListViewArray::into_array(self) -> vortex_array::ArrayRef +impl vortex_array::stats::HasArrayStats for vortex_array::arrays::ListViewArray + +pub fn vortex_array::arrays::ListViewArray::array_stats(&self) -> &vortex_array::stats::ArrayStats + impl vortex_array::vtable::ValidityHelper for vortex_array::arrays::ListViewArray pub fn vortex_array::arrays::ListViewArray::validity(&self) -> &vortex_array::validity::Validity @@ -2106,6 +2186,10 @@ impl vortex_array::arrays::ListViewVTable pub const vortex_array::arrays::ListViewVTable::ID: vortex_array::vtable::ArrayId +impl core::clone::Clone for vortex_array::arrays::ListViewVTable + +pub fn vortex_array::arrays::ListViewVTable::clone(&self) -> vortex_array::arrays::ListViewVTable + impl core::fmt::Debug for vortex_array::arrays::ListViewVTable pub fn vortex_array::arrays::ListViewVTable::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result @@ -2236,6 +2320,10 @@ impl vortex_array::IntoArray for vortex_array::arrays::MaskedArray pub fn vortex_array::arrays::MaskedArray::into_array(self) -> vortex_array::ArrayRef +impl vortex_array::stats::HasArrayStats for vortex_array::arrays::MaskedArray + +pub fn vortex_array::arrays::MaskedArray::array_stats(&self) -> &vortex_array::stats::ArrayStats + impl vortex_array::vtable::ValidityHelper for vortex_array::arrays::MaskedArray pub fn vortex_array::arrays::MaskedArray::validity(&self) -> &vortex_array::validity::Validity @@ -2246,6 +2334,10 @@ impl vortex_array::arrays::MaskedVTable pub const vortex_array::arrays::MaskedVTable::ID: vortex_array::vtable::ArrayId +impl core::clone::Clone for vortex_array::arrays::MaskedVTable + +pub fn vortex_array::arrays::MaskedVTable::clone(&self) -> vortex_array::arrays::MaskedVTable + impl core::fmt::Debug for vortex_array::arrays::MaskedVTable pub fn vortex_array::arrays::MaskedVTable::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result @@ -2430,6 +2522,10 @@ impl vortex_array::IntoArray for vortex_array::arrays::NullArray pub fn vortex_array::arrays::NullArray::into_array(self) -> vortex_array::ArrayRef +impl vortex_array::stats::HasArrayStats for vortex_array::arrays::NullArray + +pub fn vortex_array::arrays::NullArray::array_stats(&self) -> &vortex_array::stats::ArrayStats + pub struct vortex_array::arrays::NullVTable impl vortex_array::arrays::NullVTable @@ -2440,6 +2536,10 @@ impl vortex_array::arrays::NullVTable pub const vortex_array::arrays::NullVTable::TAKE_RULES: vortex_array::optimizer::rules::ParentRuleSet +impl core::clone::Clone for vortex_array::arrays::NullVTable + +pub fn vortex_array::arrays::NullVTable::clone(&self) -> vortex_array::arrays::NullVTable + impl core::fmt::Debug for vortex_array::arrays::NullVTable pub fn vortex_array::arrays::NullVTable::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result @@ -2628,6 +2728,10 @@ impl vortex_array::IntoArray for vortex_array::arrays::PrimitiveArray pub fn vortex_array::arrays::PrimitiveArray::into_array(self) -> vortex_array::ArrayRef +impl vortex_array::stats::HasArrayStats for vortex_array::arrays::PrimitiveArray + +pub fn vortex_array::arrays::PrimitiveArray::array_stats(&self) -> &vortex_array::stats::ArrayStats + impl vortex_array::vtable::ValidityHelper for vortex_array::arrays::PrimitiveArray pub fn vortex_array::arrays::PrimitiveArray::validity(&self) -> &vortex_array::validity::Validity @@ -2670,6 +2774,10 @@ impl vortex_array::arrays::PrimitiveVTable pub const vortex_array::arrays::PrimitiveVTable::ID: vortex_array::vtable::ArrayId +impl core::clone::Clone for vortex_array::arrays::PrimitiveVTable + +pub fn vortex_array::arrays::PrimitiveVTable::clone(&self) -> vortex_array::arrays::PrimitiveVTable + impl core::fmt::Debug for vortex_array::arrays::PrimitiveVTable pub fn vortex_array::arrays::PrimitiveVTable::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result @@ -2866,6 +2974,10 @@ pub fn vortex_array::arrays::ScalarFnArray::node_dtype(&self) -> vortex_error::V pub fn vortex_array::arrays::ScalarFnArray::scalar_fn(&self) -> core::option::Option<&vortex_array::scalar_fn::ScalarFnRef> +impl vortex_array::stats::HasArrayStats for vortex_array::arrays::ScalarFnArray + +pub fn vortex_array::arrays::ScalarFnArray::array_stats(&self) -> &vortex_array::stats::ArrayStats + pub struct vortex_array::arrays::ScalarFnArrayView<'a, F: vortex_array::scalar_fn::ScalarFnVTable> pub vortex_array::arrays::ScalarFnArrayView::options: &'a ::Options @@ -2994,12 +3106,20 @@ impl vortex_array::IntoArray for vortex_array::arrays::SharedArray pub fn vortex_array::arrays::SharedArray::into_array(self) -> vortex_array::ArrayRef +impl vortex_array::stats::HasArrayStats for vortex_array::arrays::SharedArray + +pub fn vortex_array::arrays::SharedArray::array_stats(&self) -> &vortex_array::stats::ArrayStats + pub struct vortex_array::arrays::SharedVTable impl vortex_array::arrays::SharedVTable pub const vortex_array::arrays::SharedVTable::ID: vortex_array::vtable::ArrayId +impl core::clone::Clone for vortex_array::arrays::SharedVTable + +pub fn vortex_array::arrays::SharedVTable::clone(&self) -> vortex_array::arrays::SharedVTable + impl core::fmt::Debug for vortex_array::arrays::SharedVTable pub fn vortex_array::arrays::SharedVTable::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result @@ -3110,6 +3230,10 @@ impl vortex_array::IntoArray for vortex_array::arrays::SliceArray pub fn vortex_array::arrays::SliceArray::into_array(self) -> vortex_array::ArrayRef +impl vortex_array::stats::HasArrayStats for vortex_array::arrays::SliceArray + +pub fn vortex_array::arrays::SliceArray::array_stats(&self) -> &vortex_array::stats::ArrayStats + pub struct vortex_array::arrays::SliceArrayParts pub vortex_array::arrays::SliceArrayParts::child: vortex_array::ArrayRef @@ -3160,6 +3284,10 @@ impl vortex_array::arrays::SliceVTable pub const vortex_array::arrays::SliceVTable::ID: vortex_array::vtable::ArrayId +impl core::clone::Clone for vortex_array::arrays::SliceVTable + +pub fn vortex_array::arrays::SliceVTable::clone(&self) -> vortex_array::arrays::SliceVTable + impl core::fmt::Debug for vortex_array::arrays::SliceVTable pub fn vortex_array::arrays::SliceVTable::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result @@ -3310,6 +3438,10 @@ impl vortex_array::IntoArray for vortex_array::arrays::StructArray pub fn vortex_array::arrays::StructArray::into_array(self) -> vortex_array::ArrayRef +impl vortex_array::stats::HasArrayStats for vortex_array::arrays::StructArray + +pub fn vortex_array::arrays::StructArray::array_stats(&self) -> &vortex_array::stats::ArrayStats + impl vortex_array::vtable::ValidityHelper for vortex_array::arrays::StructArray pub fn vortex_array::arrays::StructArray::validity(&self) -> &vortex_array::validity::Validity @@ -3328,6 +3460,10 @@ impl vortex_array::arrays::StructVTable pub const vortex_array::arrays::StructVTable::ID: vortex_array::vtable::ArrayId +impl core::clone::Clone for vortex_array::arrays::StructVTable + +pub fn vortex_array::arrays::StructVTable::clone(&self) -> vortex_array::arrays::StructVTable + impl core::fmt::Debug for vortex_array::arrays::StructVTable pub fn vortex_array::arrays::StructVTable::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result @@ -3626,6 +3762,10 @@ impl vortex_array::accessor::ArrayAccessor<[u8]> for vortex_array::arrays::VarBi pub fn vortex_array::arrays::VarBinArray::with_iterator(&self, f: F) -> R where F: for<'a> core::ops::function::FnOnce(&mut dyn core::iter::traits::iterator::Iterator>) -> R +impl vortex_array::stats::HasArrayStats for vortex_array::arrays::VarBinArray + +pub fn vortex_array::arrays::VarBinArray::array_stats(&self) -> &vortex_array::stats::ArrayStats + impl vortex_array::vtable::ValidityHelper for vortex_array::arrays::VarBinArray pub fn vortex_array::arrays::VarBinArray::validity(&self) -> &vortex_array::validity::Validity @@ -3648,6 +3788,10 @@ impl vortex_array::arrays::VarBinVTable pub fn vortex_array::arrays::VarBinVTable::_slice(array: &vortex_array::arrays::VarBinArray, range: core::ops::range::Range) -> vortex_error::VortexResult +impl core::clone::Clone for vortex_array::arrays::VarBinVTable + +pub fn vortex_array::arrays::VarBinVTable::clone(&self) -> vortex_array::arrays::VarBinVTable + impl core::fmt::Debug for vortex_array::arrays::VarBinVTable pub fn vortex_array::arrays::VarBinVTable::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result @@ -3846,6 +3990,10 @@ impl vortex_array::accessor::ArrayAccessor<[u8]> for vortex_array::arrays::VarBi pub fn vortex_array::arrays::VarBinViewArray::with_iterator core::ops::function::FnOnce(&mut dyn core::iter::traits::iterator::Iterator>) -> R, R>(&self, f: F) -> R +impl vortex_array::stats::HasArrayStats for vortex_array::arrays::VarBinViewArray + +pub fn vortex_array::arrays::VarBinViewArray::array_stats(&self) -> &vortex_array::stats::ArrayStats + impl vortex_array::vtable::ValidityHelper for vortex_array::arrays::VarBinViewArray pub fn vortex_array::arrays::VarBinViewArray::validity(&self) -> &vortex_array::validity::Validity @@ -3874,6 +4022,10 @@ impl vortex_array::arrays::VarBinViewVTable pub const vortex_array::arrays::VarBinViewVTable::ID: vortex_array::vtable::ArrayId +impl core::clone::Clone for vortex_array::arrays::VarBinViewVTable + +pub fn vortex_array::arrays::VarBinViewVTable::clone(&self) -> vortex_array::arrays::VarBinViewVTable + impl core::fmt::Debug for vortex_array::arrays::VarBinViewVTable pub fn vortex_array::arrays::VarBinViewVTable::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result @@ -15076,6 +15228,18 @@ pub fn vortex_array::arrays::ScalarFnArray::node_dtype(&self) -> vortex_error::V pub fn vortex_array::arrays::ScalarFnArray::scalar_fn(&self) -> core::option::Option<&vortex_array::scalar_fn::ScalarFnRef> +impl vortex_array::scalar_fn::ReduceNode for vortex_array::Array + +pub fn vortex_array::Array::as_any(&self) -> &dyn core::any::Any + +pub fn vortex_array::Array::child(&self, idx: usize) -> vortex_array::scalar_fn::ReduceNodeRef + +pub fn vortex_array::Array::child_count(&self) -> usize + +pub fn vortex_array::Array::node_dtype(&self) -> vortex_error::VortexResult + +pub fn vortex_array::Array::scalar_fn(&self) -> core::option::Option<&vortex_array::scalar_fn::ScalarFnRef> + impl vortex_array::scalar_fn::ReduceNode for vortex_array::ArrayAdapter pub fn vortex_array::ArrayAdapter::as_any(&self) -> &dyn core::any::Any @@ -16308,6 +16472,86 @@ pub fn vortex_array::stats::TypedStatsSetRef<'_, '_>::len(&self) -> usize pub const vortex_array::stats::PRUNING_STATS: &[vortex_array::expr::stats::Stat] +pub trait vortex_array::stats::HasArrayStats: core::fmt::Debug + +pub fn vortex_array::stats::HasArrayStats::array_stats(&self) -> &vortex_array::stats::ArrayStats + +impl vortex_array::stats::HasArrayStats for vortex_array::arrays::BoolArray + +pub fn vortex_array::arrays::BoolArray::array_stats(&self) -> &vortex_array::stats::ArrayStats + +impl vortex_array::stats::HasArrayStats for vortex_array::arrays::ChunkedArray + +pub fn vortex_array::arrays::ChunkedArray::array_stats(&self) -> &vortex_array::stats::ArrayStats + +impl vortex_array::stats::HasArrayStats for vortex_array::arrays::ConstantArray + +pub fn vortex_array::arrays::ConstantArray::array_stats(&self) -> &vortex_array::stats::ArrayStats + +impl vortex_array::stats::HasArrayStats for vortex_array::arrays::DecimalArray + +pub fn vortex_array::arrays::DecimalArray::array_stats(&self) -> &vortex_array::stats::ArrayStats + +impl vortex_array::stats::HasArrayStats for vortex_array::arrays::DictArray + +pub fn vortex_array::arrays::DictArray::array_stats(&self) -> &vortex_array::stats::ArrayStats + +impl vortex_array::stats::HasArrayStats for vortex_array::arrays::ExtensionArray + +pub fn vortex_array::arrays::ExtensionArray::array_stats(&self) -> &vortex_array::stats::ArrayStats + +impl vortex_array::stats::HasArrayStats for vortex_array::arrays::FilterArray + +pub fn vortex_array::arrays::FilterArray::array_stats(&self) -> &vortex_array::stats::ArrayStats + +impl vortex_array::stats::HasArrayStats for vortex_array::arrays::FixedSizeListArray + +pub fn vortex_array::arrays::FixedSizeListArray::array_stats(&self) -> &vortex_array::stats::ArrayStats + +impl vortex_array::stats::HasArrayStats for vortex_array::arrays::ListArray + +pub fn vortex_array::arrays::ListArray::array_stats(&self) -> &vortex_array::stats::ArrayStats + +impl vortex_array::stats::HasArrayStats for vortex_array::arrays::ListViewArray + +pub fn vortex_array::arrays::ListViewArray::array_stats(&self) -> &vortex_array::stats::ArrayStats + +impl vortex_array::stats::HasArrayStats for vortex_array::arrays::MaskedArray + +pub fn vortex_array::arrays::MaskedArray::array_stats(&self) -> &vortex_array::stats::ArrayStats + +impl vortex_array::stats::HasArrayStats for vortex_array::arrays::NullArray + +pub fn vortex_array::arrays::NullArray::array_stats(&self) -> &vortex_array::stats::ArrayStats + +impl vortex_array::stats::HasArrayStats for vortex_array::arrays::PrimitiveArray + +pub fn vortex_array::arrays::PrimitiveArray::array_stats(&self) -> &vortex_array::stats::ArrayStats + +impl vortex_array::stats::HasArrayStats for vortex_array::arrays::ScalarFnArray + +pub fn vortex_array::arrays::ScalarFnArray::array_stats(&self) -> &vortex_array::stats::ArrayStats + +impl vortex_array::stats::HasArrayStats for vortex_array::arrays::SharedArray + +pub fn vortex_array::arrays::SharedArray::array_stats(&self) -> &vortex_array::stats::ArrayStats + +impl vortex_array::stats::HasArrayStats for vortex_array::arrays::SliceArray + +pub fn vortex_array::arrays::SliceArray::array_stats(&self) -> &vortex_array::stats::ArrayStats + +impl vortex_array::stats::HasArrayStats for vortex_array::arrays::StructArray + +pub fn vortex_array::arrays::StructArray::array_stats(&self) -> &vortex_array::stats::ArrayStats + +impl vortex_array::stats::HasArrayStats for vortex_array::arrays::VarBinArray + +pub fn vortex_array::arrays::VarBinArray::array_stats(&self) -> &vortex_array::stats::ArrayStats + +impl vortex_array::stats::HasArrayStats for vortex_array::arrays::VarBinViewArray + +pub fn vortex_array::arrays::VarBinViewArray::array_stats(&self) -> &vortex_array::stats::ArrayStats + pub fn vortex_array::stats::as_stat_bitset_bytes(stats: &[vortex_array::expr::stats::Stat]) -> alloc::vec::Vec pub fn vortex_array::stats::stats_from_bitset_bytes(bytes: &[u8]) -> alloc::vec::Vec @@ -16680,9 +16924,9 @@ impl vortex_array::vtable::OperationsVTable pub fn vortex_array::vtable::NotSupported::scalar_at(array: &::Array, _index: usize) -> vortex_error::VortexResult -pub trait vortex_array::vtable::VTable: 'static + core::marker::Sized + core::marker::Send + core::marker::Sync + core::fmt::Debug +pub trait vortex_array::vtable::VTable: 'static + core::marker::Sized + core::marker::Send + core::marker::Sync + core::clone::Clone + core::fmt::Debug -pub type vortex_array::vtable::VTable::Array: 'static + core::marker::Send + core::marker::Sync + core::clone::Clone + core::fmt::Debug + core::ops::deref::Deref + vortex_array::IntoArray +pub type vortex_array::vtable::VTable::Array: 'static + core::marker::Send + core::marker::Sync + core::clone::Clone + core::fmt::Debug + core::ops::deref::Deref + vortex_array::IntoArray + vortex_array::stats::HasArrayStats pub type vortex_array::vtable::VTable::Metadata: core::fmt::Debug @@ -18120,6 +18364,126 @@ pub fn vortex_array::AnyColumnar::matches(array: &dyn vortex_array::DynArray) -> pub fn vortex_array::AnyColumnar::try_match<'a>(array: &'a dyn vortex_array::DynArray) -> core::option::Option +pub struct vortex_array::Array + +impl vortex_array::Array + +pub fn vortex_array::Array::array_stats(&self) -> &vortex_array::stats::ArrayStats + +pub fn vortex_array::Array::data(&self) -> &::Array + +pub fn vortex_array::Array::new(vtable: V, data: ::Array) -> Self + +impl core::clone::Clone for vortex_array::Array where ::Array: core::clone::Clone + +pub fn vortex_array::Array::clone(&self) -> vortex_array::Array + +impl core::fmt::Debug for vortex_array::Array where ::Array: core::fmt::Debug + +pub fn vortex_array::Array::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result + +impl vortex_array::ArrayEq for vortex_array::Array + +pub fn vortex_array::Array::array_eq(&self, other: &Self, precision: vortex_array::Precision) -> bool + +impl vortex_array::ArrayHash for vortex_array::Array + +pub fn vortex_array::Array::array_hash(&self, state: &mut H, precision: vortex_array::Precision) + +impl vortex_array::ArrayVisitor for vortex_array::Array + +pub fn vortex_array::Array::buffer_handles(&self) -> alloc::vec::Vec + +pub fn vortex_array::Array::buffer_names(&self) -> alloc::vec::Vec + +pub fn vortex_array::Array::buffers(&self) -> alloc::vec::Vec + +pub fn vortex_array::Array::children(&self) -> alloc::vec::Vec + +pub fn vortex_array::Array::children_names(&self) -> alloc::vec::Vec + +pub fn vortex_array::Array::is_host(&self) -> bool + +pub fn vortex_array::Array::metadata(&self) -> vortex_error::VortexResult>> + +pub fn vortex_array::Array::metadata_fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result + +pub fn vortex_array::Array::named_buffers(&self) -> alloc::vec::Vec<(alloc::string::String, vortex_array::buffer::BufferHandle)> + +pub fn vortex_array::Array::named_children(&self) -> alloc::vec::Vec<(alloc::string::String, vortex_array::ArrayRef)> + +pub fn vortex_array::Array::nbuffers(&self) -> usize + +pub fn vortex_array::Array::nchildren(&self) -> usize + +pub fn vortex_array::Array::nth_child(&self, idx: usize) -> core::option::Option + +impl vortex_array::DynArray for vortex_array::Array + +pub fn vortex_array::Array::all_invalid(&self) -> vortex_error::VortexResult + +pub fn vortex_array::Array::all_valid(&self) -> vortex_error::VortexResult + +pub fn vortex_array::Array::append_to_builder(&self, builder: &mut dyn vortex_array::builders::ArrayBuilder, ctx: &mut vortex_array::ExecutionCtx) -> vortex_error::VortexResult<()> + +pub fn vortex_array::Array::as_any(&self) -> &dyn core::any::Any + +pub fn vortex_array::Array::as_any_arc(self: alloc::sync::Arc) -> alloc::sync::Arc<(dyn core::any::Any + core::marker::Send + core::marker::Sync)> + +pub fn vortex_array::Array::dtype(&self) -> &vortex_array::dtype::DType + +pub fn vortex_array::Array::encoding_id(&self) -> vortex_array::vtable::ArrayId + +pub fn vortex_array::Array::filter(&self, mask: vortex_mask::Mask) -> vortex_error::VortexResult + +pub fn vortex_array::Array::invalid_count(&self) -> vortex_error::VortexResult + +pub fn vortex_array::Array::is_empty(&self) -> bool + +pub fn vortex_array::Array::is_invalid(&self, index: usize) -> vortex_error::VortexResult + +pub fn vortex_array::Array::is_valid(&self, index: usize) -> vortex_error::VortexResult + +pub fn vortex_array::Array::len(&self) -> usize + +pub fn vortex_array::Array::scalar_at(&self, index: usize) -> vortex_error::VortexResult + +pub fn vortex_array::Array::slice(&self, range: core::ops::range::Range) -> vortex_error::VortexResult + +pub fn vortex_array::Array::statistics(&self) -> vortex_array::stats::StatsSetRef<'_> + +pub fn vortex_array::Array::take(&self, indices: vortex_array::ArrayRef) -> vortex_error::VortexResult + +pub fn vortex_array::Array::to_array(&self) -> vortex_array::ArrayRef + +pub fn vortex_array::Array::to_canonical(&self) -> vortex_error::VortexResult + +pub fn vortex_array::Array::valid_count(&self) -> vortex_error::VortexResult + +pub fn vortex_array::Array::validity(&self) -> vortex_error::VortexResult + +pub fn vortex_array::Array::validity_mask(&self) -> vortex_error::VortexResult + +pub fn vortex_array::Array::vtable(&self) -> &dyn vortex_array::vtable::DynVTable + +pub fn vortex_array::Array::with_children(&self, children: alloc::vec::Vec) -> vortex_error::VortexResult + +impl vortex_array::IntoArray for vortex_array::Array + +pub fn vortex_array::Array::into_array(self) -> vortex_array::ArrayRef + +impl vortex_array::scalar_fn::ReduceNode for vortex_array::Array + +pub fn vortex_array::Array::as_any(&self) -> &dyn core::any::Any + +pub fn vortex_array::Array::child(&self, idx: usize) -> vortex_array::scalar_fn::ReduceNodeRef + +pub fn vortex_array::Array::child_count(&self) -> usize + +pub fn vortex_array::Array::node_dtype(&self) -> vortex_error::VortexResult + +pub fn vortex_array::Array::scalar_fn(&self) -> core::option::Option<&vortex_array::scalar_fn::ScalarFnRef> + #[repr(transparent)] pub struct vortex_array::ArrayAdapter(_) impl vortex_array::ArrayAdapter @@ -18382,6 +18746,10 @@ impl vortex_array::ArrayEq for core::option::Option pub fn core::option::Option::array_eq(&self, other: &Self, precision: vortex_array::Precision) -> bool +impl vortex_array::ArrayEq for vortex_array::Array + +pub fn vortex_array::Array::array_eq(&self, other: &Self, precision: vortex_array::Precision) -> bool + impl vortex_array::ArrayEq for vortex_array::ArrayAdapter pub fn vortex_array::ArrayAdapter::array_eq(&self, other: &Self, precision: vortex_array::Precision) -> bool @@ -18426,6 +18794,10 @@ impl vortex_array::ArrayHash for core::option::Optio pub fn core::option::Option::array_hash(&self, state: &mut H, precision: vortex_array::Precision) +impl vortex_array::ArrayHash for vortex_array::Array + +pub fn vortex_array::Array::array_hash(&self, state: &mut H, precision: vortex_array::Precision) + impl vortex_array::ArrayHash for vortex_array::ArrayAdapter pub fn vortex_array::ArrayAdapter::array_hash(&self, state: &mut H, precision: vortex_array::Precision) @@ -18486,6 +18858,34 @@ pub fn alloc::sync::Arc::nchildren(&self) -> usize pub fn alloc::sync::Arc::nth_child(&self, idx: usize) -> core::option::Option +impl vortex_array::ArrayVisitor for vortex_array::Array + +pub fn vortex_array::Array::buffer_handles(&self) -> alloc::vec::Vec + +pub fn vortex_array::Array::buffer_names(&self) -> alloc::vec::Vec + +pub fn vortex_array::Array::buffers(&self) -> alloc::vec::Vec + +pub fn vortex_array::Array::children(&self) -> alloc::vec::Vec + +pub fn vortex_array::Array::children_names(&self) -> alloc::vec::Vec + +pub fn vortex_array::Array::is_host(&self) -> bool + +pub fn vortex_array::Array::metadata(&self) -> vortex_error::VortexResult>> + +pub fn vortex_array::Array::metadata_fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result + +pub fn vortex_array::Array::named_buffers(&self) -> alloc::vec::Vec<(alloc::string::String, vortex_array::buffer::BufferHandle)> + +pub fn vortex_array::Array::named_children(&self) -> alloc::vec::Vec<(alloc::string::String, vortex_array::ArrayRef)> + +pub fn vortex_array::Array::nbuffers(&self) -> usize + +pub fn vortex_array::Array::nchildren(&self) -> usize + +pub fn vortex_array::Array::nth_child(&self, idx: usize) -> core::option::Option + impl vortex_array::ArrayVisitor for vortex_array::ArrayAdapter pub fn vortex_array::ArrayAdapter::buffer_handles(&self) -> alloc::vec::Vec @@ -18650,6 +19050,56 @@ pub fn alloc::sync::Arc::vtable(&self) -> &dyn vorte pub fn alloc::sync::Arc::with_children(&self, children: alloc::vec::Vec) -> vortex_error::VortexResult +impl vortex_array::DynArray for vortex_array::Array + +pub fn vortex_array::Array::all_invalid(&self) -> vortex_error::VortexResult + +pub fn vortex_array::Array::all_valid(&self) -> vortex_error::VortexResult + +pub fn vortex_array::Array::append_to_builder(&self, builder: &mut dyn vortex_array::builders::ArrayBuilder, ctx: &mut vortex_array::ExecutionCtx) -> vortex_error::VortexResult<()> + +pub fn vortex_array::Array::as_any(&self) -> &dyn core::any::Any + +pub fn vortex_array::Array::as_any_arc(self: alloc::sync::Arc) -> alloc::sync::Arc<(dyn core::any::Any + core::marker::Send + core::marker::Sync)> + +pub fn vortex_array::Array::dtype(&self) -> &vortex_array::dtype::DType + +pub fn vortex_array::Array::encoding_id(&self) -> vortex_array::vtable::ArrayId + +pub fn vortex_array::Array::filter(&self, mask: vortex_mask::Mask) -> vortex_error::VortexResult + +pub fn vortex_array::Array::invalid_count(&self) -> vortex_error::VortexResult + +pub fn vortex_array::Array::is_empty(&self) -> bool + +pub fn vortex_array::Array::is_invalid(&self, index: usize) -> vortex_error::VortexResult + +pub fn vortex_array::Array::is_valid(&self, index: usize) -> vortex_error::VortexResult + +pub fn vortex_array::Array::len(&self) -> usize + +pub fn vortex_array::Array::scalar_at(&self, index: usize) -> vortex_error::VortexResult + +pub fn vortex_array::Array::slice(&self, range: core::ops::range::Range) -> vortex_error::VortexResult + +pub fn vortex_array::Array::statistics(&self) -> vortex_array::stats::StatsSetRef<'_> + +pub fn vortex_array::Array::take(&self, indices: vortex_array::ArrayRef) -> vortex_error::VortexResult + +pub fn vortex_array::Array::to_array(&self) -> vortex_array::ArrayRef + +pub fn vortex_array::Array::to_canonical(&self) -> vortex_error::VortexResult + +pub fn vortex_array::Array::valid_count(&self) -> vortex_error::VortexResult + +pub fn vortex_array::Array::validity(&self) -> vortex_error::VortexResult + +pub fn vortex_array::Array::validity_mask(&self) -> vortex_error::VortexResult + +pub fn vortex_array::Array::vtable(&self) -> &dyn vortex_array::vtable::DynVTable + +pub fn vortex_array::Array::with_children(&self, children: alloc::vec::Vec) -> vortex_error::VortexResult + impl vortex_array::DynArray for vortex_array::ArrayAdapter pub fn vortex_array::ArrayAdapter::all_invalid(&self) -> vortex_error::VortexResult @@ -18924,6 +19374,10 @@ impl vortex_array::IntoArray for arrow_buffer::buffer::scalar::ScalarBuffer::into_array(self) -> vortex_array::ArrayRef +impl vortex_array::IntoArray for vortex_array::Array + +pub fn vortex_array::Array::into_array(self) -> vortex_array::ArrayRef + pub trait vortex_array::SerializeMetadata pub fn vortex_array::SerializeMetadata::serialize(self) -> alloc::vec::Vec diff --git a/vortex-python/src/arrays/native.rs b/vortex-python/src/arrays/native.rs index f3a4fb429b3..1fdfaf59cce 100644 --- a/vortex-python/src/arrays/native.rs +++ b/vortex-python/src/arrays/native.rs @@ -5,6 +5,7 @@ use std::ops::Deref; use pyo3::PyClass; use pyo3::prelude::*; +use vortex::array::Array; use vortex::array::ArrayAdapter; use vortex::array::ArrayRef; use vortex::array::DynArray; @@ -251,11 +252,13 @@ pub trait AsArrayRef { impl AsArrayRef<::Array> for PyRef<'_, V> { fn as_array_ref(&self) -> &::Array { - self.as_super() - .inner() - .as_any() - .downcast_ref::>() - .vortex_expect("Failed to downcast array") - .as_inner() + let any = self.as_super().inner().as_any(); + if let Some(array) = any.downcast_ref::>() { + array.data() + } else { + any.downcast_ref::>() + .vortex_expect("Failed to downcast array") + .as_inner() + } } }