diff --git a/Cargo.lock b/Cargo.lock index 52f583dd2cc..c925ab4d18c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -961,7 +961,7 @@ dependencies = [ "bitflags", "cexpr", "clang-sys", - "itertools 0.10.5", + "itertools 0.13.0", "log", "prettyplease", "proc-macro2", @@ -3534,7 +3534,7 @@ dependencies = [ "libc", "option-ext", "redox_users", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -3726,7 +3726,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -4898,7 +4898,7 @@ checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46" dependencies = [ "hermit-abi", "libc", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -4979,7 +4979,7 @@ dependencies = [ "portable-atomic", "portable-atomic-util", "serde_core", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -5603,6 +5603,16 @@ dependencies = [ "uuid", ] +[[package]] +name = "lasso" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e14eda50a3494b3bf7b9ce51c52434a761e383d7238ce1dd5dcec2fbc13e9fb" +dependencies = [ + "dashmap", + "hashbrown 0.14.5", +] + [[package]] name = "lazy_static" version = "1.5.0" @@ -6287,7 +6297,7 @@ version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -6958,9 +6968,9 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "044b1fa4f259f4df9ad5078e587b208f5d288a25407575fcddb9face30c7c692" dependencies = [ - "rand 0.8.5", + "rand 0.9.2", "socket2", - "thiserror 1.0.69", + "thiserror 2.0.18", ] [[package]] @@ -7167,7 +7177,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "343d3bd7056eda839b03204e68deff7d1b13aba7af2b2fd16890697274262ee7" dependencies = [ "heck", - "itertools 0.10.5", + "itertools 0.14.0", "log", "multimap", "petgraph", @@ -7199,7 +7209,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27c6023962132f4b30eb4c172c91ce92d933da334c59c23cddee82358ddafb0b" dependencies = [ "anyhow", - "itertools 0.10.5", + "itertools 0.14.0", "proc-macro2", "quote", "syn 2.0.117", @@ -8154,7 +8164,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.12.1", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -8212,7 +8222,7 @@ dependencies = [ "security-framework", "security-framework-sys", "webpki-root-certs", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -9291,7 +9301,7 @@ dependencies = [ "getrandom 0.4.2", "once_cell", "rustix 1.1.4", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -9310,7 +9320,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "230a1b821ccbd75b185820a1f1ff7b14d21da1e442e22c0863ea5f08771a8874" dependencies = [ "rustix 1.1.4", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -10903,6 +10913,7 @@ version = "0.1.0" dependencies = [ "arcref", "dashmap", + "lasso", "parking_lot", "vortex-error", "vortex-utils", @@ -11282,7 +11293,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 3c67020c38a..f4cfcecbf38 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -163,6 +163,7 @@ itertools = "0.14.0" jetscii = "0.5.3" jiff = "0.2.0" kanal = "0.1.1" +lasso = { version = "0.7", features = ["multi-threaded"] } lending-iterator = "0.1.7" libfuzzer-sys = "0.4" libloading = "0.8" diff --git a/encodings/alp/public-api.lock b/encodings/alp/public-api.lock index 0f3259d6d6f..ff4535970be 100644 --- a/encodings/alp/public-api.lock +++ b/encodings/alp/public-api.lock @@ -6,10 +6,6 @@ pub struct vortex_alp::ALP impl vortex_alp::ALP -pub const vortex_alp::ALP::ID: vortex_array::array::ArrayId - -impl vortex_alp::ALP - pub fn vortex_alp::ALP::new(encoded: vortex_array::array::erased::ArrayRef, exponents: vortex_alp::Exponents, patches: core::option::Option) -> vortex_alp::ALPArray pub unsafe fn vortex_alp::ALP::new_unchecked(encoded: vortex_array::array::erased::ArrayRef, exponents: vortex_alp::Exponents, patches: core::option::Option) -> vortex_alp::ALPArray @@ -148,8 +144,6 @@ pub struct vortex_alp::ALPRD impl vortex_alp::ALPRD -pub const vortex_alp::ALPRD::ID: vortex_array::array::ArrayId - pub unsafe fn vortex_alp::ALPRD::new_unchecked(dtype: vortex_array::dtype::DType, left_parts: vortex_array::array::erased::ArrayRef, left_parts_dictionary: vortex_buffer::buffer::Buffer, right_parts: vortex_array::array::erased::ArrayRef, right_bit_width: u8, left_parts_patches: core::option::Option) -> vortex_alp::ALPRDArray pub fn vortex_alp::ALPRD::try_new(dtype: vortex_array::dtype::DType, left_parts: vortex_array::array::erased::ArrayRef, left_parts_dictionary: vortex_buffer::buffer::Buffer, right_parts: vortex_array::array::erased::ArrayRef, right_bit_width: u8, left_parts_patches: core::option::Option) -> vortex_error::VortexResult diff --git a/encodings/alp/src/alp/array.rs b/encodings/alp/src/alp/array.rs index 2c3d2d70923..be0db0f938e 100644 --- a/encodings/alp/src/alp/array.rs +++ b/encodings/alp/src/alp/array.rs @@ -39,6 +39,7 @@ use vortex_error::vortex_bail; use vortex_error::vortex_ensure; use vortex_error::vortex_panic; use vortex_session::VortexSession; +use vortex_session::registry::CachedId; use crate::ALPFloat; use crate::alp::Exponents; @@ -72,7 +73,8 @@ impl VTable for ALP { type ValidityVTable = ValidityVTableFromChild; fn id(&self) -> ArrayId { - Self::ID + static ID: CachedId = CachedId::new("vortex.alp"); + *ID } fn validate( @@ -237,10 +239,6 @@ impl Display for ALPData { #[derive(Clone, Debug)] pub struct ALP; -impl ALP { - pub const ID: ArrayId = ArrayId::new_ref("vortex.alp"); -} - #[derive(Clone, prost::Message)] pub struct ALPMetadata { #[prost(uint32, tag = "1")] diff --git a/encodings/alp/src/alp/plugin.rs b/encodings/alp/src/alp/plugin.rs index 020acb7e1ac..3b2c36ebd02 100644 --- a/encodings/alp/src/alp/plugin.rs +++ b/encodings/alp/src/alp/plugin.rs @@ -6,9 +6,11 @@ //! //! This enables zero-cost backward compatibility with previously written datasets. +use vortex_array::Array; use vortex_array::ArrayId; use vortex_array::ArrayPlugin; use vortex_array::ArrayRef; +use vortex_array::ArrayVTable; use vortex_array::IntoArray; use vortex_array::VortexSessionExecute; use vortex_array::arrays::Patched; @@ -32,7 +34,8 @@ impl ArrayPlugin for ALPPatchedPlugin { fn id(&self) -> ArrayId { // We reuse the existing `ALP` ID so that we can take over its // deserialization pathway. - ALP::ID + // TODO(joe): dedup method name + ArrayVTable::id(&ALP) } fn serialize( @@ -53,10 +56,10 @@ impl ArrayPlugin for ALPPatchedPlugin { children: &dyn ArrayChildren, session: &VortexSession, ) -> VortexResult { - let alp_array = ALP - .deserialize(dtype, len, metadata, buffers, children, session)? - .try_downcast::() - .map_err(|_| vortex_err!("ALP plugin should only deserialize vortex.alp"))?; + let alp_array = Array::::try_from_parts(ArrayVTable::deserialize( + &ALP, dtype, len, metadata, buffers, children, session, + )?) + .map_err(|_| vortex_err!("ALP plugin should only deserialize vortex.alp"))?; // Check if there are interior patches to externalize. let Some(patches) = alp_array.patches() else { @@ -78,7 +81,8 @@ impl ArrayPlugin for ALPPatchedPlugin { } fn is_supported_encoding(&self, id: &ArrayId) -> bool { - id == &Patched.id() || id == &ALP.id() + // TODO(joe): dedup method name + id == ArrayVTable::id(&Patched) || id == ArrayVTable::id(&ALP) } } diff --git a/encodings/alp/src/alp_rd/array.rs b/encodings/alp/src/alp_rd/array.rs index c4d6d3b7f02..be5f5f9a918 100644 --- a/encodings/alp/src/alp_rd/array.rs +++ b/encodings/alp/src/alp_rd/array.rs @@ -44,6 +44,7 @@ use vortex_error::vortex_ensure; use vortex_error::vortex_err; use vortex_error::vortex_panic; use vortex_session::VortexSession; +use vortex_session::registry::CachedId; use crate::alp_rd::kernel::PARENT_KERNELS; use crate::alp_rd::rules::RULES; @@ -92,7 +93,8 @@ impl VTable for ALPRD { type ValidityVTable = ValidityVTableFromChild; fn id(&self) -> ArrayId { - Self::ID + static ID: CachedId = CachedId::new("vortex.alprd"); + *ID } fn validate( @@ -357,8 +359,6 @@ pub struct ALPRDDataParts { pub struct ALPRD; impl ALPRD { - pub const ID: ArrayId = ArrayId::new_ref("vortex.alprd"); - pub fn try_new( dtype: DType, left_parts: ArrayRef, diff --git a/encodings/alp/src/lib.rs b/encodings/alp/src/lib.rs index 35a7534d7aa..05ce75763b2 100644 --- a/encodings/alp/src/lib.rs +++ b/encodings/alp/src/lib.rs @@ -18,6 +18,7 @@ pub use alp::*; pub use alp_rd::*; +use vortex_array::ArrayVTable; use vortex_array::aggregate_fn::AggregateFnVTable; use vortex_array::aggregate_fn::fns::nan_count::NanCount; use vortex_array::aggregate_fn::session::AggregateFnSessionExt; @@ -41,7 +42,7 @@ pub fn initialize(session: &VortexSession) { // Register the ALP-specific NaN count aggregate kernel. session.aggregate_fns().register_aggregate_kernel( - ALP::ID, + ALP.id(), Some(NanCount.id()), &compute::nan_count::ALPNanCountKernel, ); diff --git a/encodings/bytebool/public-api.lock b/encodings/bytebool/public-api.lock index 63d9c1b9518..514f8742a28 100644 --- a/encodings/bytebool/public-api.lock +++ b/encodings/bytebool/public-api.lock @@ -4,8 +4,6 @@ pub struct vortex_bytebool::ByteBool impl vortex_bytebool::ByteBool -pub const vortex_bytebool::ByteBool::ID: vortex_array::array::ArrayId - pub fn vortex_bytebool::ByteBool::from_option_vec(data: alloc::vec::Vec>) -> vortex_bytebool::ByteBoolArray pub fn vortex_bytebool::ByteBool::from_vec>(data: alloc::vec::Vec, validity: V) -> vortex_bytebool::ByteBoolArray diff --git a/encodings/bytebool/src/array.rs b/encodings/bytebool/src/array.rs index c1a2ebf7fce..28205d973be 100644 --- a/encodings/bytebool/src/array.rs +++ b/encodings/bytebool/src/array.rs @@ -37,6 +37,7 @@ use vortex_error::vortex_ensure; use vortex_error::vortex_panic; use vortex_mask::Mask; use vortex_session::VortexSession; +use vortex_session::registry::CachedId; use crate::kernel::PARENT_KERNELS; @@ -62,7 +63,8 @@ impl VTable for ByteBool { type ValidityVTable = Self; fn id(&self) -> ArrayId { - Self::ID + static ID: CachedId = CachedId::new("vortex.bytebool"); + *ID } fn validate( @@ -200,8 +202,6 @@ impl> ByteBoolArrayExt for T {} pub struct ByteBool; impl ByteBool { - pub const ID: ArrayId = ArrayId::new_ref("vortex.bytebool"); - pub fn new(buffer: BufferHandle, validity: Validity) -> ByteBoolArray { let dtype = DType::Bool(validity.nullability()); let slots = ByteBoolData::make_slots(&validity, buffer.len()); diff --git a/encodings/datetime-parts/public-api.lock b/encodings/datetime-parts/public-api.lock index 3cdc22cc7b7..555681ac824 100644 --- a/encodings/datetime-parts/public-api.lock +++ b/encodings/datetime-parts/public-api.lock @@ -4,8 +4,6 @@ pub struct vortex_datetime_parts::DateTimeParts impl vortex_datetime_parts::DateTimeParts -pub const vortex_datetime_parts::DateTimeParts::ID: vortex_array::array::ArrayId - pub fn vortex_datetime_parts::DateTimeParts::try_from_temporal(temporal: vortex_array::arrays::datetime::TemporalArray) -> vortex_error::VortexResult pub fn vortex_datetime_parts::DateTimeParts::try_new(dtype: vortex_array::dtype::DType, days: vortex_array::array::erased::ArrayRef, seconds: vortex_array::array::erased::ArrayRef, subseconds: vortex_array::array::erased::ArrayRef) -> vortex_error::VortexResult diff --git a/encodings/datetime-parts/src/array.rs b/encodings/datetime-parts/src/array.rs index f66bd2b742a..67edc3dfc20 100644 --- a/encodings/datetime-parts/src/array.rs +++ b/encodings/datetime-parts/src/array.rs @@ -35,6 +35,7 @@ use vortex_error::vortex_ensure; use vortex_error::vortex_err; use vortex_error::vortex_panic; use vortex_session::VortexSession; +use vortex_session::registry::CachedId; use crate::TemporalParts; use crate::canonical::decode_to_temporal; @@ -92,7 +93,8 @@ impl VTable for DateTimeParts { type ValidityVTable = ValidityVTableFromChild; fn id(&self) -> ArrayId { - Self::ID + static ID: CachedId = CachedId::new("vortex.datetimeparts"); + *ID } fn validate( @@ -250,8 +252,6 @@ impl> DateTimePartsArrayExt for T {} pub struct DateTimeParts; impl DateTimeParts { - pub const ID: ArrayId = ArrayId::new_ref("vortex.datetimeparts"); - /// Construct a new [`DateTimePartsArray`] from its components. pub fn try_new( dtype: DType, diff --git a/encodings/datetime-parts/src/lib.rs b/encodings/datetime-parts/src/lib.rs index 1babf4abaab..e061d69bccd 100644 --- a/encodings/datetime-parts/src/lib.rs +++ b/encodings/datetime-parts/src/lib.rs @@ -11,6 +11,7 @@ mod compute; mod ops; mod timestamp; +use vortex_array::ArrayVTable; use vortex_array::aggregate_fn::AggregateFnVTable; use vortex_array::aggregate_fn::fns::is_constant::IsConstant; use vortex_array::aggregate_fn::session::AggregateFnSessionExt; @@ -22,7 +23,7 @@ pub fn initialize(session: &VortexSession) { session.arrays().register(DateTimeParts); session.aggregate_fns().register_aggregate_kernel( - DateTimeParts::ID, + DateTimeParts.id(), Some(IsConstant.id()), &compute::is_constant::DateTimePartsIsConstantKernel, ); diff --git a/encodings/decimal-byte-parts/public-api.lock b/encodings/decimal-byte-parts/public-api.lock index 397885e1b45..57a83581aa2 100644 --- a/encodings/decimal-byte-parts/public-api.lock +++ b/encodings/decimal-byte-parts/public-api.lock @@ -4,8 +4,6 @@ pub struct vortex_decimal_byte_parts::DecimalByteParts impl vortex_decimal_byte_parts::DecimalByteParts -pub const vortex_decimal_byte_parts::DecimalByteParts::ID: vortex_array::array::ArrayId - pub fn vortex_decimal_byte_parts::DecimalByteParts::try_new(msp: vortex_array::array::erased::ArrayRef, decimal_dtype: vortex_array::dtype::decimal::DecimalDType) -> vortex_error::VortexResult impl core::clone::Clone for vortex_decimal_byte_parts::DecimalByteParts 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 ea90bf575e0..390fd15f0fe 100644 --- a/encodings/decimal-byte-parts/src/decimal_byte_parts/mod.rs +++ b/encodings/decimal-byte-parts/src/decimal_byte_parts/mod.rs @@ -43,6 +43,7 @@ use vortex_error::vortex_bail; use vortex_error::vortex_ensure; use vortex_error::vortex_panic; use vortex_session::VortexSession; +use vortex_session::registry::CachedId; use crate::decimal_byte_parts::compute::kernel::PARENT_KERNELS; use crate::decimal_byte_parts::rules::PARENT_RULES; @@ -75,7 +76,8 @@ impl VTable for DecimalByteParts { type ValidityVTable = ValidityVTableFromChild; fn id(&self) -> ArrayId { - Self::ID + static ID: CachedId = CachedId::new("vortex.decimal_byte_parts"); + *ID } fn validate( @@ -253,8 +255,6 @@ impl DecimalBytePartsData { pub struct DecimalByteParts; impl DecimalByteParts { - pub const ID: ArrayId = ArrayId::new_ref("vortex.decimal_byte_parts"); - /// Construct a new [`DecimalBytePartsArray`] from an MSP array and decimal dtype. pub fn try_new( msp: ArrayRef, diff --git a/encodings/decimal-byte-parts/src/lib.rs b/encodings/decimal-byte-parts/src/lib.rs index 58c2d1dc69a..86566027afa 100644 --- a/encodings/decimal-byte-parts/src/lib.rs +++ b/encodings/decimal-byte-parts/src/lib.rs @@ -13,6 +13,7 @@ use decimal_byte_parts::compute::is_constant::DecimalBytePartsIsConstantKernel; /// an i128 decimal could be converted into a [i64, u64] with further narrowing applied to either /// value. pub use decimal_byte_parts::*; +use vortex_array::ArrayVTable; use vortex_array::aggregate_fn::AggregateFnVTable; use vortex_array::aggregate_fn::fns::is_constant::IsConstant; use vortex_array::aggregate_fn::session::AggregateFnSessionExt; @@ -24,7 +25,7 @@ pub fn initialize(session: &VortexSession) { session.arrays().register(DecimalByteParts); session.aggregate_fns().register_aggregate_kernel( - DecimalByteParts::ID, + DecimalByteParts.id(), Some(IsConstant.id()), &DecimalBytePartsIsConstantKernel, ); diff --git a/encodings/fastlanes/public-api.lock b/encodings/fastlanes/public-api.lock index 7746cd91168..cf7776cd872 100644 --- a/encodings/fastlanes/public-api.lock +++ b/encodings/fastlanes/public-api.lock @@ -120,8 +120,6 @@ pub struct vortex_fastlanes::BitPacked impl vortex_fastlanes::BitPacked -pub const vortex_fastlanes::BitPacked::ID: vortex_array::array::ArrayId - pub fn vortex_fastlanes::BitPacked::encode(array: &vortex_array::array::erased::ArrayRef, bit_width: u8) -> vortex_error::VortexResult pub fn vortex_fastlanes::BitPacked::into_parts(array: vortex_fastlanes::BitPackedArray) -> vortex_fastlanes::BitPackedDataParts @@ -280,8 +278,6 @@ pub struct vortex_fastlanes::Delta impl vortex_fastlanes::Delta -pub const vortex_fastlanes::Delta::ID: vortex_array::array::ArrayId - pub fn vortex_fastlanes::Delta::try_from_primitive_array(array: &vortex_array::arrays::primitive::vtable::PrimitiveArray, ctx: &mut vortex_array::executor::ExecutionCtx) -> vortex_error::VortexResult pub fn vortex_fastlanes::Delta::try_new(bases: vortex_array::array::erased::ArrayRef, deltas: vortex_array::array::erased::ArrayRef, offset: usize, len: usize) -> vortex_error::VortexResult @@ -368,8 +364,6 @@ pub struct vortex_fastlanes::FoR impl vortex_fastlanes::FoR -pub const vortex_fastlanes::FoR::ID: vortex_array::array::ArrayId - pub fn vortex_fastlanes::FoR::encode(array: vortex_array::arrays::primitive::vtable::PrimitiveArray) -> vortex_error::VortexResult pub fn vortex_fastlanes::FoR::try_new(encoded: vortex_array::array::erased::ArrayRef, reference: vortex_array::scalar::Scalar) -> vortex_error::VortexResult @@ -474,8 +468,6 @@ pub struct vortex_fastlanes::RLE impl vortex_fastlanes::RLE -pub const vortex_fastlanes::RLE::ID: vortex_array::array::ArrayId - pub fn vortex_fastlanes::RLE::encode(array: vortex_array::array::view::ArrayView<'_, vortex_array::arrays::primitive::vtable::Primitive>) -> vortex_error::VortexResult pub unsafe fn vortex_fastlanes::RLE::new_unchecked(values: vortex_array::array::erased::ArrayRef, indices: vortex_array::array::erased::ArrayRef, values_idx_offsets: vortex_array::array::erased::ArrayRef, offset: usize, length: usize) -> vortex_fastlanes::RLEArray diff --git a/encodings/fastlanes/src/bitpacking/plugin.rs b/encodings/fastlanes/src/bitpacking/plugin.rs index b712d45b45b..fec101ff895 100644 --- a/encodings/fastlanes/src/bitpacking/plugin.rs +++ b/encodings/fastlanes/src/bitpacking/plugin.rs @@ -6,9 +6,11 @@ //! //! This enables zero-cost backward compatibility with previously written datasets. +use vortex_array::Array; use vortex_array::ArrayId; use vortex_array::ArrayPlugin; use vortex_array::ArrayRef; +use vortex_array::ArrayVTable; use vortex_array::IntoArray; use vortex_array::VortexSessionExecute; use vortex_array::arrays::Patched; @@ -31,7 +33,8 @@ impl ArrayPlugin for BitPackedPatchedPlugin { fn id(&self) -> ArrayId { // We reuse the existing `BitPacked` ID so that we can take over its // deserialization pathway. - BitPacked::ID + // TODO(joe): dedup method name + ArrayVTable::id(&BitPacked) } fn serialize( @@ -52,12 +55,10 @@ impl ArrayPlugin for BitPackedPatchedPlugin { children: &dyn ArrayChildren, session: &VortexSession, ) -> VortexResult { - let bitpacked = BitPacked - .deserialize(dtype, len, metadata, buffers, children, session)? - .try_downcast::() - .map_err(|_| { - vortex_err!("BitPacked plugin should only deserialize fastlanes.bitpacked") - })?; + let bitpacked = Array::::try_from_parts(ArrayVTable::deserialize( + &BitPacked, dtype, len, metadata, buffers, children, session, + )?) + .map_err(|_| vortex_err!("BitPacked plugin should only deserialize fastlanes.bitpacked"))?; // Create a new BitPackedArray without the interior patches installed. let Some(patches) = bitpacked.patches() else { @@ -84,7 +85,7 @@ impl ArrayPlugin for BitPackedPatchedPlugin { } fn is_supported_encoding(&self, id: &ArrayId) -> bool { - id == &BitPacked::ID || id == &Patched.id() + id == ArrayVTable::id(&BitPacked) || id == ArrayVTable::id(&Patched) } } diff --git a/encodings/fastlanes/src/bitpacking/vtable/mod.rs b/encodings/fastlanes/src/bitpacking/vtable/mod.rs index 93c5d116fdc..9c1875468a1 100644 --- a/encodings/fastlanes/src/bitpacking/vtable/mod.rs +++ b/encodings/fastlanes/src/bitpacking/vtable/mod.rs @@ -36,6 +36,7 @@ use vortex_error::vortex_bail; use vortex_error::vortex_err; use vortex_error::vortex_panic; use vortex_session::VortexSession; +use vortex_session::registry::CachedId; use crate::BitPackedArrayExt; use crate::BitPackedData; @@ -91,7 +92,8 @@ impl VTable for BitPacked { type ValidityVTable = Self; fn id(&self) -> ArrayId { - Self::ID + static ID: CachedId = CachedId::new("fastlanes.bitpacked"); + *ID } fn validate( @@ -309,8 +311,6 @@ impl VTable for BitPacked { pub struct BitPacked; impl BitPacked { - pub const ID: ArrayId = ArrayId::new_ref("fastlanes.bitpacked"); - pub fn try_new( packed: BufferHandle, ptype: PType, diff --git a/encodings/fastlanes/src/delta/vtable/mod.rs b/encodings/fastlanes/src/delta/vtable/mod.rs index e74243b4050..bb5add65aa0 100644 --- a/encodings/fastlanes/src/delta/vtable/mod.rs +++ b/encodings/fastlanes/src/delta/vtable/mod.rs @@ -30,6 +30,7 @@ use vortex_error::vortex_ensure; use vortex_error::vortex_err; use vortex_error::vortex_panic; use vortex_session::VortexSession; +use vortex_session::registry::CachedId; use crate::DeltaData; use crate::delta::array::BASES_SLOT; @@ -75,7 +76,8 @@ impl VTable for Delta { type ValidityVTable = Self; fn id(&self) -> ArrayId { - Self::ID + static ID: CachedId = CachedId::new("fastlanes.delta"); + *ID } fn validate( @@ -180,8 +182,6 @@ impl VTable for Delta { pub struct Delta; impl Delta { - pub const ID: ArrayId = ArrayId::new_ref("fastlanes.delta"); - pub fn try_new( bases: ArrayRef, deltas: ArrayRef, diff --git a/encodings/fastlanes/src/for/vtable/mod.rs b/encodings/fastlanes/src/for/vtable/mod.rs index 3f3207a8e24..85f7cf2429b 100644 --- a/encodings/fastlanes/src/for/vtable/mod.rs +++ b/encodings/fastlanes/src/for/vtable/mod.rs @@ -30,6 +30,7 @@ use vortex_error::vortex_bail; use vortex_error::vortex_ensure; use vortex_error::vortex_panic; use vortex_session::VortexSession; +use vortex_session::registry::CachedId; use crate::FoRData; use crate::r#for::array::FoRArrayExt; @@ -66,7 +67,8 @@ impl VTable for FoR { type ValidityVTable = ValidityVTableFromChild; fn id(&self) -> ArrayId { - Self::ID + static ID: CachedId = CachedId::new("fastlanes.for"); + *ID } fn validate( @@ -162,8 +164,6 @@ impl VTable for FoR { pub struct FoR; impl FoR { - pub const ID: ArrayId = ArrayId::new_ref("fastlanes.for"); - /// Construct a new FoR array from an encoded array and a reference scalar. pub fn try_new(encoded: ArrayRef, reference: Scalar) -> VortexResult { vortex_ensure!(!reference.is_null(), "Reference value cannot be null"); diff --git a/encodings/fastlanes/src/lib.rs b/encodings/fastlanes/src/lib.rs index 763c55484ea..217d05d73b8 100644 --- a/encodings/fastlanes/src/lib.rs +++ b/encodings/fastlanes/src/lib.rs @@ -24,6 +24,7 @@ pub(crate) const FL_CHUNK_SIZE: usize = 1024; use bitpacking::compute::is_constant::BitPackedIsConstantKernel; use r#for::compute::is_constant::FoRIsConstantKernel; use r#for::compute::is_sorted::FoRIsSortedKernel; +use vortex_array::ArrayVTable; use vortex_array::aggregate_fn::AggregateFnVTable; use vortex_array::aggregate_fn::fns::is_constant::IsConstant; use vortex_array::aggregate_fn::fns::is_sorted::IsSorted; @@ -47,17 +48,17 @@ pub fn initialize(session: &VortexSession) { // Register the encoding-specific aggregate kernels. session.aggregate_fns().register_aggregate_kernel( - BitPacked::ID, + BitPacked.id(), Some(IsConstant.id()), &BitPackedIsConstantKernel, ); session.aggregate_fns().register_aggregate_kernel( - FoR::ID, + FoR.id(), Some(IsConstant.id()), &FoRIsConstantKernel, ); session.aggregate_fns().register_aggregate_kernel( - FoR::ID, + FoR.id(), Some(IsSorted.id()), &FoRIsSortedKernel, ); diff --git a/encodings/fastlanes/src/rle/vtable/mod.rs b/encodings/fastlanes/src/rle/vtable/mod.rs index 9587603aacc..6d37aad85fd 100644 --- a/encodings/fastlanes/src/rle/vtable/mod.rs +++ b/encodings/fastlanes/src/rle/vtable/mod.rs @@ -28,6 +28,7 @@ use vortex_error::VortexResult; use vortex_error::vortex_ensure; use vortex_error::vortex_panic; use vortex_session::VortexSession; +use vortex_session::registry::CachedId; use crate::RLEData; use crate::rle::array::INDICES_SLOT; @@ -80,7 +81,8 @@ impl VTable for RLE { type ValidityVTable = Self; fn id(&self) -> ArrayId { - Self::ID + static ID: CachedId = CachedId::new("fastlanes.rle"); + *ID } fn validate( @@ -209,8 +211,6 @@ impl VTable for RLE { pub struct RLE; impl RLE { - pub const ID: ArrayId = ArrayId::new_ref("fastlanes.rle"); - pub fn try_new( values: ArrayRef, indices: ArrayRef, diff --git a/encodings/fsst/public-api.lock b/encodings/fsst/public-api.lock index 341a2fd8222..024701dad3b 100644 --- a/encodings/fsst/public-api.lock +++ b/encodings/fsst/public-api.lock @@ -4,8 +4,6 @@ pub struct vortex_fsst::FSST impl vortex_fsst::FSST -pub const vortex_fsst::FSST::ID: vortex_array::array::ArrayId - pub fn vortex_fsst::FSST::try_new(dtype: vortex_array::dtype::DType, symbols: vortex_buffer::buffer::Buffer, symbol_lengths: vortex_buffer::buffer::Buffer, codes: vortex_array::arrays::varbin::vtable::VarBinArray, uncompressed_lengths: vortex_array::array::erased::ArrayRef) -> vortex_error::VortexResult impl core::clone::Clone for vortex_fsst::FSST diff --git a/encodings/fsst/src/array.rs b/encodings/fsst/src/array.rs index 5526276aeb4..d3a51a254e9 100644 --- a/encodings/fsst/src/array.rs +++ b/encodings/fsst/src/array.rs @@ -49,6 +49,7 @@ use vortex_error::vortex_ensure; use vortex_error::vortex_err; use vortex_error::vortex_panic; use vortex_session::VortexSession; +use vortex_session::registry::CachedId; use crate::canonical::canonicalize_fsst; use crate::canonical::fsst_decode_views; @@ -101,7 +102,8 @@ impl VTable for FSST { type ValidityVTable = Self; fn id(&self) -> ArrayId { - Self::ID + static ID: CachedId = CachedId::new("vortex.fsst"); + *ID } fn validate( @@ -363,8 +365,6 @@ impl Debug for FSSTData { pub struct FSST; impl FSST { - pub const ID: ArrayId = ArrayId::new_ref("vortex.fsst"); - /// Build an FSST array from a set of `symbols` and `codes`. /// /// The `codes` VarBinArray is decomposed: its bytes are stored in [`FSSTData`], while diff --git a/encodings/parquet-variant/src/vtable.rs b/encodings/parquet-variant/src/vtable.rs index efc501cdac6..7dc3b3c90b2 100644 --- a/encodings/parquet-variant/src/vtable.rs +++ b/encodings/parquet-variant/src/vtable.rs @@ -30,6 +30,7 @@ use vortex_error::vortex_err; use vortex_error::vortex_panic; use vortex_proto::dtype as pb; use vortex_session::VortexSession; +use vortex_session::registry::CachedId; use crate::array::METADATA_SLOT; use crate::array::ParquetVariantArrayExt; @@ -45,10 +46,6 @@ use crate::kernel::PARENT_KERNELS; #[derive(Debug, Clone)] pub struct ParquetVariant; -impl ParquetVariant { - pub const ID: ArrayId = ArrayId::new_ref("vortex.parquet.variant"); -} - #[derive(Clone, prost::Message)] struct ParquetVariantMetadataProto { /// Whether the un-shredded `value` child is present. @@ -71,7 +68,8 @@ impl VTable for ParquetVariant { type ValidityVTable = Self; fn id(&self) -> ArrayId { - Self::ID + static ID: CachedId = CachedId::new("vortex.parquet.variant"); + *ID } fn validate( diff --git a/encodings/pco/public-api.lock b/encodings/pco/public-api.lock index 07307c38196..1020dfa0eb1 100644 --- a/encodings/pco/public-api.lock +++ b/encodings/pco/public-api.lock @@ -4,8 +4,6 @@ pub struct vortex_pco::Pco impl vortex_pco::Pco -pub const vortex_pco::Pco::ID: vortex_array::array::ArrayId - pub fn vortex_pco::Pco::from_primitive(parray: vortex_array::array::view::ArrayView<'_, vortex_array::arrays::primitive::vtable::Primitive>, level: usize, values_per_page: usize) -> vortex_error::VortexResult impl core::clone::Clone for vortex_pco::Pco diff --git a/encodings/pco/src/array.rs b/encodings/pco/src/array.rs index 8f83dbd8fa8..7c8e74c825c 100644 --- a/encodings/pco/src/array.rs +++ b/encodings/pco/src/array.rs @@ -55,6 +55,7 @@ use vortex_error::vortex_bail; use vortex_error::vortex_ensure; use vortex_error::vortex_err; use vortex_session::VortexSession; +use vortex_session::registry::CachedId; use crate::PcoChunkInfo; use crate::PcoMetadata; @@ -129,7 +130,8 @@ impl VTable for Pco { type ValidityVTable = Self; fn id(&self) -> ArrayId { - Self::ID + static ID: CachedId = CachedId::new("vortex.pco"); + *ID } fn validate( @@ -273,8 +275,6 @@ pub(crate) fn vortex_err_from_pco(err: PcoError) -> VortexError { pub struct Pco; impl Pco { - pub const ID: ArrayId = ArrayId::new_ref("vortex.pco"); - pub(crate) fn try_new( dtype: DType, data: PcoData, diff --git a/encodings/runend/public-api.lock b/encodings/runend/public-api.lock index c746d4f54a4..163db53f69e 100644 --- a/encodings/runend/public-api.lock +++ b/encodings/runend/public-api.lock @@ -20,8 +20,6 @@ pub struct vortex_runend::RunEnd impl vortex_runend::RunEnd -pub const vortex_runend::RunEnd::ID: vortex_array::array::ArrayId - pub fn vortex_runend::RunEnd::encode(array: vortex_array::array::erased::ArrayRef) -> vortex_error::VortexResult pub fn vortex_runend::RunEnd::new(ends: vortex_array::array::erased::ArrayRef, values: vortex_array::array::erased::ArrayRef) -> vortex_runend::RunEndArray diff --git a/encodings/runend/src/array.rs b/encodings/runend/src/array.rs index f714d09fc70..5844f2c9cf4 100644 --- a/encodings/runend/src/array.rs +++ b/encodings/runend/src/array.rs @@ -39,6 +39,7 @@ use vortex_error::vortex_bail; use vortex_error::vortex_ensure; use vortex_error::vortex_panic; use vortex_session::VortexSession; +use vortex_session::registry::CachedId; use crate::compress::runend_decode_primitive; use crate::compress::runend_decode_varbinview; @@ -79,7 +80,8 @@ impl VTable for RunEnd { type ValidityVTable = Self; fn id(&self) -> ArrayId { - Self::ID + static ID: CachedId = CachedId::new("vortex.runend"); + *ID } fn validate( @@ -241,8 +243,6 @@ impl> RunEndArrayExt for T {} pub struct RunEnd; impl RunEnd { - pub const ID: ArrayId = ArrayId::new_ref("vortex.runend"); - /// Build a new [`RunEndArray`] without validation. /// /// # Safety diff --git a/encodings/runend/src/lib.rs b/encodings/runend/src/lib.rs index cff09767d38..8770dbbf58e 100644 --- a/encodings/runend/src/lib.rs +++ b/encodings/runend/src/lib.rs @@ -26,6 +26,7 @@ pub mod _benchmarking { use super::*; } +use vortex_array::ArrayVTable; use vortex_array::aggregate_fn::AggregateFnVTable; use vortex_array::aggregate_fn::fns::is_constant::IsConstant; use vortex_array::aggregate_fn::fns::is_sorted::IsSorted; @@ -40,17 +41,17 @@ pub fn initialize(session: &VortexSession) { // Register the RunEnd-specific aggregate kernels. session.aggregate_fns().register_aggregate_kernel( - RunEnd::ID, + RunEnd.id(), Some(MinMax.id()), &compute::min_max::RunEndMinMaxKernel, ); session.aggregate_fns().register_aggregate_kernel( - RunEnd::ID, + RunEnd.id(), Some(IsConstant.id()), &compute::is_constant::RunEndIsConstantKernel, ); session.aggregate_fns().register_aggregate_kernel( - RunEnd::ID, + RunEnd.id(), Some(IsSorted.id()), &compute::is_sorted::RunEndIsSortedKernel, ); diff --git a/encodings/sequence/public-api.lock b/encodings/sequence/public-api.lock index 6bb8f69d1d2..455a2fd9809 100644 --- a/encodings/sequence/public-api.lock +++ b/encodings/sequence/public-api.lock @@ -4,8 +4,6 @@ pub struct vortex_sequence::Sequence impl vortex_sequence::Sequence -pub const vortex_sequence::Sequence::ID: vortex_array::array::ArrayId - pub fn vortex_sequence::Sequence::try_new(base: vortex_array::scalar::typed_view::primitive::pvalue::PValue, multiplier: vortex_array::scalar::typed_view::primitive::pvalue::PValue, ptype: vortex_array::dtype::ptype::PType, nullability: vortex_array::dtype::nullability::Nullability, length: usize) -> vortex_error::VortexResult pub fn vortex_sequence::Sequence::try_new_typed>(base: T, multiplier: T, nullability: vortex_array::dtype::nullability::Nullability, length: usize) -> vortex_error::VortexResult diff --git a/encodings/sequence/src/array.rs b/encodings/sequence/src/array.rs index f941d4cf1a6..413862a6c30 100644 --- a/encodings/sequence/src/array.rs +++ b/encodings/sequence/src/array.rs @@ -45,6 +45,7 @@ use vortex_error::vortex_ensure; use vortex_error::vortex_err; use vortex_error::vortex_panic; use vortex_session::VortexSession; +use vortex_session::registry::CachedId; use crate::compress::sequence_decompress; use crate::kernel::PARENT_KERNELS; @@ -231,7 +232,8 @@ impl VTable for Sequence { type ValidityVTable = Self; fn id(&self) -> ArrayId { - Self::ID + static ID: CachedId = CachedId::new("vortex.sequence"); + *ID } fn validate( @@ -369,8 +371,6 @@ impl ValidityVTable for Sequence { pub struct Sequence; impl Sequence { - pub const ID: ArrayId = ArrayId::new_ref("vortex.sequence"); - fn stats(multiplier: PValue) -> StatsSet { // A sequence A[i] = base + i * multiplier is sorted iff multiplier >= 0, // and strictly sorted iff multiplier > 0. diff --git a/encodings/sequence/src/lib.rs b/encodings/sequence/src/lib.rs index aec425e0bae..bd6ab2f508c 100644 --- a/encodings/sequence/src/lib.rs +++ b/encodings/sequence/src/lib.rs @@ -16,6 +16,7 @@ pub use array::SequenceArray; pub use array::SequenceData; pub use array::SequenceDataParts; pub use compress::sequence_encode; +use vortex_array::ArrayVTable; use vortex_array::aggregate_fn::AggregateFnVTable; use vortex_array::aggregate_fn::fns::is_sorted::IsSorted; use vortex_array::aggregate_fn::fns::min_max::MinMax; @@ -29,12 +30,12 @@ pub fn initialize(session: &VortexSession) { // Register the Sequence-specific aggregate kernels. session.aggregate_fns().register_aggregate_kernel( - Sequence::ID, + Sequence.id(), Some(MinMax.id()), &compute::min_max::SequenceMinMaxKernel, ); session.aggregate_fns().register_aggregate_kernel( - Sequence::ID, + Sequence.id(), Some(IsSorted.id()), &compute::is_sorted::SequenceIsSortedKernel, ); diff --git a/encodings/sparse/public-api.lock b/encodings/sparse/public-api.lock index 30a2e9a726c..9bcfb086753 100644 --- a/encodings/sparse/public-api.lock +++ b/encodings/sparse/public-api.lock @@ -4,8 +4,6 @@ pub struct vortex_sparse::Sparse impl vortex_sparse::Sparse -pub const vortex_sparse::Sparse::ID: vortex_array::array::ArrayId - pub fn vortex_sparse::Sparse::encode(array: &vortex_array::array::erased::ArrayRef, fill_value: core::option::Option) -> vortex_error::VortexResult pub fn vortex_sparse::Sparse::try_new(indices: vortex_array::array::erased::ArrayRef, values: vortex_array::array::erased::ArrayRef, len: usize, fill_value: vortex_array::scalar::Scalar) -> vortex_error::VortexResult diff --git a/encodings/sparse/src/lib.rs b/encodings/sparse/src/lib.rs index 87fd640fd1c..845d918a7a3 100644 --- a/encodings/sparse/src/lib.rs +++ b/encodings/sparse/src/lib.rs @@ -47,6 +47,7 @@ use vortex_error::vortex_panic; use vortex_mask::AllOr; use vortex_mask::Mask; use vortex_session::VortexSession; +use vortex_session::registry::CachedId; use crate::canonical::execute_sparse; use crate::rules::RULES; @@ -88,7 +89,8 @@ impl VTable for Sparse { type ValidityVTable = Self; fn id(&self) -> ArrayId { - Self::ID + static ID: CachedId = CachedId::new("vortex.sparse"); + *ID } fn validate( @@ -227,8 +229,6 @@ impl Display for SparseData { pub struct Sparse; impl Sparse { - pub const ID: ArrayId = ArrayId::new_ref("vortex.sparse"); - /// Construct a new [`SparseArray`] from indices, values, length, and fill value. pub fn try_new( indices: ArrayRef, diff --git a/encodings/zigzag/public-api.lock b/encodings/zigzag/public-api.lock index d94894a7ca0..299344043ad 100644 --- a/encodings/zigzag/public-api.lock +++ b/encodings/zigzag/public-api.lock @@ -4,8 +4,6 @@ pub struct vortex_zigzag::ZigZag impl vortex_zigzag::ZigZag -pub const vortex_zigzag::ZigZag::ID: vortex_array::array::ArrayId - pub fn vortex_zigzag::ZigZag::try_new(encoded: vortex_array::array::erased::ArrayRef) -> vortex_error::VortexResult impl core::clone::Clone for vortex_zigzag::ZigZag diff --git a/encodings/zigzag/src/array.rs b/encodings/zigzag/src/array.rs index 851b40b438b..bc10192ce78 100644 --- a/encodings/zigzag/src/array.rs +++ b/encodings/zigzag/src/array.rs @@ -33,6 +33,7 @@ use vortex_error::vortex_bail; use vortex_error::vortex_ensure; use vortex_error::vortex_panic; use vortex_session::VortexSession; +use vortex_session::registry::CachedId; use zigzag::ZigZag as ExternalZigZag; use crate::compute::ZigZagEncoded; @@ -50,7 +51,8 @@ impl VTable for ZigZag { type ValidityVTable = ValidityVTableFromChild; fn id(&self) -> ArrayId { - Self::ID + static ID: CachedId = CachedId::new("vortex.zigzag"); + *ID } fn validate( @@ -195,8 +197,6 @@ impl> ZigZagArrayExt for T {} pub struct ZigZag; impl ZigZag { - pub const ID: ArrayId = ArrayId::new_ref("vortex.zigzag"); - /// Construct a new [`ZigZagArray`] from an encoded unsigned integer array. pub fn try_new(encoded: ArrayRef) -> VortexResult { let dtype = ZigZagData::dtype_from_encoded_dtype(encoded.dtype())?; diff --git a/encodings/zstd/public-api.lock b/encodings/zstd/public-api.lock index 44365606591..7a4e13bb8cd 100644 --- a/encodings/zstd/public-api.lock +++ b/encodings/zstd/public-api.lock @@ -4,8 +4,6 @@ pub struct vortex_zstd::Zstd impl vortex_zstd::Zstd -pub const vortex_zstd::Zstd::ID: vortex_array::array::ArrayId - pub fn vortex_zstd::Zstd::decompress(array: &vortex_zstd::ZstdArray, ctx: &mut vortex_array::executor::ExecutionCtx) -> vortex_error::VortexResult pub fn vortex_zstd::Zstd::from_primitive(parray: &vortex_array::arrays::primitive::vtable::PrimitiveArray, level: i32, values_per_frame: usize) -> vortex_error::VortexResult diff --git a/encodings/zstd/src/array.rs b/encodings/zstd/src/array.rs index a11d48defb6..789a0ae91ad 100644 --- a/encodings/zstd/src/array.rs +++ b/encodings/zstd/src/array.rs @@ -55,6 +55,7 @@ use vortex_error::vortex_err; use vortex_error::vortex_panic; use vortex_mask::AllOr; use vortex_session::VortexSession; +use vortex_session::registry::CachedId; use crate::ZstdFrameMetadata; use crate::ZstdMetadata; @@ -134,7 +135,8 @@ impl VTable for Zstd { type ValidityVTable = Self; fn id(&self) -> ArrayId { - Self::ID + static ID: CachedId = CachedId::new("vortex.zstd"); + *ID } fn validate( @@ -253,8 +255,6 @@ impl VTable for Zstd { pub struct Zstd; impl Zstd { - pub const ID: ArrayId = ArrayId::new_ref("vortex.zstd"); - pub fn try_new(dtype: DType, data: ZstdData, validity: Validity) -> VortexResult { let len = data.len(); data.validate(&dtype, len, &validity)?; diff --git a/encodings/zstd/src/zstd_buffers.rs b/encodings/zstd/src/zstd_buffers.rs index e1712b01c2e..ffeb70210ae 100644 --- a/encodings/zstd/src/zstd_buffers.rs +++ b/encodings/zstd/src/zstd_buffers.rs @@ -34,6 +34,7 @@ use vortex_error::VortexResult; use vortex_error::vortex_ensure_eq; use vortex_error::vortex_err; use vortex_session::VortexSession; +use vortex_session::registry::CachedId; use crate::ZstdBuffersMetadata; @@ -44,8 +45,6 @@ pub type ZstdBuffersArray = Array; pub struct ZstdBuffers; impl ZstdBuffers { - pub const ID: ArrayId = ArrayId::new_ref("vortex.zstd_buffers"); - pub fn try_new( dtype: DType, len: usize, @@ -333,7 +332,7 @@ fn compute_output_layout( } fn array_id_from_string(s: &str) -> ArrayId { - ArrayId::new_arc(Arc::from(s)) + ArrayId::new(s) } impl ArrayHash for ZstdBuffersData { @@ -369,7 +368,8 @@ impl VTable for ZstdBuffers { type ValidityVTable = Self; fn id(&self) -> ArrayId { - Self::ID + static ID: CachedId = CachedId::new("vortex.zstd_buffers"); + *ID } fn validate( diff --git a/vortex-array/public-api.lock b/vortex-array/public-api.lock index d79cc795aa1..8f26230791a 100644 --- a/vortex-array/public-api.lock +++ b/vortex-array/public-api.lock @@ -562,7 +562,7 @@ impl vortex_array::aggregate_fn::session::AggregateFnSession pub fn vortex_array::aggregate_fn::session::AggregateFnSession::register(&self, vtable: V) -pub fn vortex_array::aggregate_fn::session::AggregateFnSession::register_aggregate_kernel(&self, array_id: vortex_array::ArrayId, agg_fn_id: core::option::Option, kernel: &'static dyn vortex_array::aggregate_fn::kernels::DynAggregateKernel) +pub fn vortex_array::aggregate_fn::session::AggregateFnSession::register_aggregate_kernel(&self, array_id: impl core::convert::Into, agg_fn_id: core::option::Option>, kernel: &'static dyn vortex_array::aggregate_fn::kernels::DynAggregateKernel) pub fn vortex_array::aggregate_fn::session::AggregateFnSession::registry(&self) -> &vortex_array::aggregate_fn::session::AggregateFnRegistry @@ -744,7 +744,7 @@ impl vortex_array::aggregate_f pub fn V::deserialize(&self, metadata: &[u8], session: &vortex_session::VortexSession) -> core::result::Result -pub fn V::id(&self) -> arcref::ArcRef +pub fn V::id(&self) -> vortex_session::registry::Id pub trait vortex_array::aggregate_fn::AggregateFnVTable: 'static + core::marker::Sized + core::clone::Clone + core::marker::Send + core::marker::Sync @@ -1116,7 +1116,7 @@ pub fn vortex_array::aggregate_fn::GroupedAccumulator::flush(&mut self) -> vo pub type vortex_array::aggregate_fn::AccumulatorRef = alloc::boxed::Box -pub type vortex_array::aggregate_fn::AggregateFnId = arcref::ArcRef +pub type vortex_array::aggregate_fn::AggregateFnId = vortex_session::registry::Id pub type vortex_array::aggregate_fn::AggregateFnPluginRef = alloc::sync::Arc @@ -1128,10 +1128,6 @@ pub mod vortex_array::arrays::bool pub struct vortex_array::arrays::bool::Bool -impl vortex_array::arrays::Bool - -pub const vortex_array::arrays::Bool::ID: vortex_array::ArrayId - impl core::clone::Clone for vortex_array::arrays::Bool pub fn vortex_array::arrays::Bool::clone(&self) -> vortex_array::arrays::Bool @@ -1306,10 +1302,6 @@ pub mod vortex_array::arrays::chunked pub struct vortex_array::arrays::chunked::Chunked -impl vortex_array::arrays::Chunked - -pub const vortex_array::arrays::Chunked::ID: vortex_array::ArrayId - impl core::clone::Clone for vortex_array::arrays::Chunked pub fn vortex_array::arrays::Chunked::clone(&self) -> vortex_array::arrays::Chunked @@ -1472,10 +1464,6 @@ pub struct vortex_array::arrays::constant::Constant impl vortex_array::arrays::Constant -pub const vortex_array::arrays::Constant::ID: vortex_array::ArrayId - -impl vortex_array::arrays::Constant - pub const vortex_array::arrays::Constant::TAKE_RULES: vortex_array::optimizer::rules::ParentRuleSet impl core::clone::Clone for vortex_array::arrays::Constant @@ -1658,10 +1646,6 @@ pub mod vortex_array::arrays::decimal pub struct vortex_array::arrays::decimal::Decimal -impl vortex_array::arrays::Decimal - -pub const vortex_array::arrays::Decimal::ID: vortex_array::ArrayId - impl core::clone::Clone for vortex_array::arrays::Decimal pub fn vortex_array::arrays::Decimal::clone(&self) -> vortex_array::arrays::Decimal @@ -1878,10 +1862,6 @@ pub mod vortex_array::arrays::dict::vtable pub struct vortex_array::arrays::dict::vtable::Dict -impl vortex_array::arrays::dict::Dict - -pub const vortex_array::arrays::dict::Dict::ID: vortex_array::ArrayId - impl core::clone::Clone for vortex_array::arrays::dict::Dict pub fn vortex_array::arrays::dict::Dict::clone(&self) -> vortex_array::arrays::dict::Dict @@ -1974,10 +1954,6 @@ pub type vortex_array::arrays::dict::vtable::DictArray = vortex_array::Array vortex_array::arrays::dict::Dict @@ -2312,10 +2288,6 @@ pub mod vortex_array::arrays::extension pub struct vortex_array::arrays::extension::Extension -impl vortex_array::arrays::Extension - -pub const vortex_array::arrays::Extension::ID: vortex_array::ArrayId - impl core::clone::Clone for vortex_array::arrays::Extension pub fn vortex_array::arrays::Extension::clone(&self) -> vortex_array::arrays::Extension @@ -2442,10 +2414,6 @@ pub mod vortex_array::arrays::filter pub struct vortex_array::arrays::filter::Filter -impl vortex_array::arrays::Filter - -pub const vortex_array::arrays::Filter::ID: vortex_array::ArrayId - impl core::clone::Clone for vortex_array::arrays::Filter pub fn vortex_array::arrays::Filter::clone(&self) -> vortex_array::arrays::Filter @@ -2634,10 +2602,6 @@ pub mod vortex_array::arrays::fixed_size_list pub struct vortex_array::arrays::fixed_size_list::FixedSizeList -impl vortex_array::arrays::FixedSizeList - -pub const vortex_array::arrays::FixedSizeList::ID: vortex_array::ArrayId - impl core::clone::Clone for vortex_array::arrays::FixedSizeList pub fn vortex_array::arrays::FixedSizeList::clone(&self) -> vortex_array::arrays::FixedSizeList @@ -2782,10 +2746,6 @@ pub mod vortex_array::arrays::list pub struct vortex_array::arrays::list::List -impl vortex_array::arrays::List - -pub const vortex_array::arrays::List::ID: vortex_array::ArrayId - impl core::clone::Clone for vortex_array::arrays::List pub fn vortex_array::arrays::List::clone(&self) -> vortex_array::arrays::List @@ -2966,10 +2926,6 @@ pub vortex_array::arrays::listview::ListViewRebuildMode::TrimElements pub struct vortex_array::arrays::listview::ListView -impl vortex_array::arrays::ListView - -pub const vortex_array::arrays::ListView::ID: vortex_array::ArrayId - impl core::clone::Clone for vortex_array::arrays::ListView pub fn vortex_array::arrays::ListView::clone(&self) -> vortex_array::arrays::ListView @@ -3150,10 +3106,6 @@ pub mod vortex_array::arrays::masked pub struct vortex_array::arrays::masked::Masked -impl vortex_array::arrays::Masked - -pub const vortex_array::arrays::Masked::ID: vortex_array::ArrayId - impl core::clone::Clone for vortex_array::arrays::Masked pub fn vortex_array::arrays::Masked::clone(&self) -> vortex_array::arrays::Masked @@ -3278,10 +3230,6 @@ pub struct vortex_array::arrays::null::Null impl vortex_array::arrays::null::Null -pub const vortex_array::arrays::null::Null::ID: vortex_array::ArrayId - -impl vortex_array::arrays::null::Null - pub const vortex_array::arrays::null::Null::TAKE_RULES: vortex_array::optimizer::rules::ParentRuleSet impl core::clone::Clone for vortex_array::arrays::null::Null @@ -3656,10 +3604,6 @@ pub fn vortex_array::arrays::primitive::NativeValue::partial_cmp(&self, other pub struct vortex_array::arrays::primitive::Primitive -impl vortex_array::arrays::Primitive - -pub const vortex_array::arrays::Primitive::ID: vortex_array::ArrayId - impl core::clone::Clone for vortex_array::arrays::Primitive pub fn vortex_array::arrays::Primitive::clone(&self) -> vortex_array::arrays::Primitive @@ -4064,10 +4008,6 @@ pub mod vortex_array::arrays::shared pub struct vortex_array::arrays::shared::Shared -impl vortex_array::arrays::Shared - -pub const vortex_array::arrays::Shared::ID: vortex_array::ArrayId - impl core::clone::Clone for vortex_array::arrays::Shared pub fn vortex_array::arrays::Shared::clone(&self) -> vortex_array::arrays::Shared @@ -4180,10 +4120,6 @@ pub mod vortex_array::arrays::slice pub struct vortex_array::arrays::slice::Slice -impl vortex_array::arrays::slice::Slice - -pub const vortex_array::arrays::slice::Slice::ID: vortex_array::ArrayId - impl core::clone::Clone for vortex_array::arrays::slice::Slice pub fn vortex_array::arrays::slice::Slice::clone(&self) -> vortex_array::arrays::slice::Slice @@ -4410,10 +4346,6 @@ pub mod vortex_array::arrays::struct_ pub struct vortex_array::arrays::struct_::Struct -impl vortex_array::arrays::Struct - -pub const vortex_array::arrays::Struct::ID: vortex_array::ArrayId - impl core::clone::Clone for vortex_array::arrays::Struct pub fn vortex_array::arrays::Struct::clone(&self) -> vortex_array::arrays::Struct @@ -4572,10 +4504,6 @@ pub struct vortex_array::arrays::varbin::VarBin impl vortex_array::arrays::VarBin -pub const vortex_array::arrays::VarBin::ID: vortex_array::ArrayId - -impl vortex_array::arrays::VarBin - pub fn vortex_array::arrays::VarBin::_slice(array: vortex_array::ArrayView<'_, vortex_array::arrays::VarBin>, range: core::ops::range::Range) -> vortex_error::VortexResult impl core::clone::Clone for vortex_array::arrays::VarBin @@ -4944,10 +4872,6 @@ impl core::marker::Copy for vortex_array::arrays::varbinview::Ref pub struct vortex_array::arrays::varbinview::VarBinView -impl vortex_array::arrays::VarBinView - -pub const vortex_array::arrays::VarBinView::ID: vortex_array::ArrayId - impl core::clone::Clone for vortex_array::arrays::VarBinView pub fn vortex_array::arrays::VarBinView::clone(&self) -> vortex_array::arrays::VarBinView @@ -5134,10 +5058,6 @@ pub mod vortex_array::arrays::variant pub struct vortex_array::arrays::variant::Variant -impl vortex_array::arrays::Variant - -pub const vortex_array::arrays::Variant::ID: vortex_array::ArrayId - impl core::clone::Clone for vortex_array::arrays::Variant pub fn vortex_array::arrays::Variant::clone(&self) -> vortex_array::arrays::Variant @@ -5206,10 +5126,6 @@ pub type vortex_array::arrays::variant::VariantArray = vortex_array::Array vortex_array::arrays::Bool @@ -5298,10 +5214,6 @@ pub fn vortex_array::arrays::Bool::mask(array: vortex_array::ArrayView<'_, vorte pub struct vortex_array::arrays::Chunked -impl vortex_array::arrays::Chunked - -pub const vortex_array::arrays::Chunked::ID: vortex_array::ArrayId - impl core::clone::Clone for vortex_array::arrays::Chunked pub fn vortex_array::arrays::Chunked::clone(&self) -> vortex_array::arrays::Chunked @@ -5390,10 +5302,6 @@ pub struct vortex_array::arrays::Constant impl vortex_array::arrays::Constant -pub const vortex_array::arrays::Constant::ID: vortex_array::ArrayId - -impl vortex_array::arrays::Constant - pub const vortex_array::arrays::Constant::TAKE_RULES: vortex_array::optimizer::rules::ParentRuleSet impl core::clone::Clone for vortex_array::arrays::Constant @@ -5482,10 +5390,6 @@ pub fn vortex_array::arrays::Constant::invert(array: vortex_array::ArrayView<'_, pub struct vortex_array::arrays::Decimal -impl vortex_array::arrays::Decimal - -pub const vortex_array::arrays::Decimal::ID: vortex_array::ArrayId - impl core::clone::Clone for vortex_array::arrays::Decimal pub fn vortex_array::arrays::Decimal::clone(&self) -> vortex_array::arrays::Decimal @@ -5574,10 +5478,6 @@ pub fn vortex_array::arrays::Decimal::mask(array: vortex_array::ArrayView<'_, vo pub struct vortex_array::arrays::Dict -impl vortex_array::arrays::dict::Dict - -pub const vortex_array::arrays::dict::Dict::ID: vortex_array::ArrayId - impl core::clone::Clone for vortex_array::arrays::dict::Dict pub fn vortex_array::arrays::dict::Dict::clone(&self) -> vortex_array::arrays::dict::Dict @@ -5668,10 +5568,6 @@ pub fn vortex_array::arrays::dict::Dict::mask(array: vortex_array::ArrayView<'_, pub struct vortex_array::arrays::Extension -impl vortex_array::arrays::Extension - -pub const vortex_array::arrays::Extension::ID: vortex_array::ArrayId - impl core::clone::Clone for vortex_array::arrays::Extension pub fn vortex_array::arrays::Extension::clone(&self) -> vortex_array::arrays::Extension @@ -5754,10 +5650,6 @@ pub fn vortex_array::arrays::Extension::mask(array: vortex_array::ArrayView<'_, pub struct vortex_array::arrays::Filter -impl vortex_array::arrays::Filter - -pub const vortex_array::arrays::Filter::ID: vortex_array::ArrayId - impl core::clone::Clone for vortex_array::arrays::Filter pub fn vortex_array::arrays::Filter::clone(&self) -> vortex_array::arrays::Filter @@ -5816,10 +5708,6 @@ pub fn vortex_array::arrays::Filter::validity(array: vortex_array::ArrayView<'_, pub struct vortex_array::arrays::FixedSizeList -impl vortex_array::arrays::FixedSizeList - -pub const vortex_array::arrays::FixedSizeList::ID: vortex_array::ArrayId - impl core::clone::Clone for vortex_array::arrays::FixedSizeList pub fn vortex_array::arrays::FixedSizeList::clone(&self) -> vortex_array::arrays::FixedSizeList @@ -5894,10 +5782,6 @@ pub fn vortex_array::arrays::FixedSizeList::mask(array: vortex_array::ArrayView< pub struct vortex_array::arrays::List -impl vortex_array::arrays::List - -pub const vortex_array::arrays::List::ID: vortex_array::ArrayId - impl core::clone::Clone for vortex_array::arrays::List pub fn vortex_array::arrays::List::clone(&self) -> vortex_array::arrays::List @@ -5976,10 +5860,6 @@ pub fn vortex_array::arrays::List::mask(array: vortex_array::ArrayView<'_, vorte pub struct vortex_array::arrays::ListView -impl vortex_array::arrays::ListView - -pub const vortex_array::arrays::ListView::ID: vortex_array::ArrayId - impl core::clone::Clone for vortex_array::arrays::ListView pub fn vortex_array::arrays::ListView::clone(&self) -> vortex_array::arrays::ListView @@ -6054,10 +5934,6 @@ pub fn vortex_array::arrays::ListView::mask(array: vortex_array::ArrayView<'_, v pub struct vortex_array::arrays::Masked -impl vortex_array::arrays::Masked - -pub const vortex_array::arrays::Masked::ID: vortex_array::ArrayId - impl core::clone::Clone for vortex_array::arrays::Masked pub fn vortex_array::arrays::Masked::clone(&self) -> vortex_array::arrays::Masked @@ -6134,10 +6010,6 @@ pub struct vortex_array::arrays::Null impl vortex_array::arrays::null::Null -pub const vortex_array::arrays::null::Null::ID: vortex_array::ArrayId - -impl vortex_array::arrays::null::Null - pub const vortex_array::arrays::null::Null::TAKE_RULES: vortex_array::optimizer::rules::ParentRuleSet impl core::clone::Clone for vortex_array::arrays::null::Null @@ -6296,10 +6168,6 @@ pub fn vortex_array::arrays::patched::Patched::compare(lhs: vortex_array::ArrayV pub struct vortex_array::arrays::Primitive -impl vortex_array::arrays::Primitive - -pub const vortex_array::arrays::Primitive::ID: vortex_array::ArrayId - impl core::clone::Clone for vortex_array::arrays::Primitive pub fn vortex_array::arrays::Primitive::clone(&self) -> vortex_array::arrays::Primitive @@ -6446,10 +6314,6 @@ pub fn vortex_array::arrays::scalar_fn::ScalarFnVTable::validity(array: vortex_a pub struct vortex_array::arrays::Shared -impl vortex_array::arrays::Shared - -pub const vortex_array::arrays::Shared::ID: vortex_array::ArrayId - impl core::clone::Clone for vortex_array::arrays::Shared pub fn vortex_array::arrays::Shared::clone(&self) -> vortex_array::arrays::Shared @@ -6508,10 +6372,6 @@ pub fn vortex_array::arrays::Shared::validity(array: vortex_array::ArrayView<'_, pub struct vortex_array::arrays::Slice -impl vortex_array::arrays::slice::Slice - -pub const vortex_array::arrays::slice::Slice::ID: vortex_array::ArrayId - impl core::clone::Clone for vortex_array::arrays::slice::Slice pub fn vortex_array::arrays::slice::Slice::clone(&self) -> vortex_array::arrays::slice::Slice @@ -6574,10 +6434,6 @@ pub fn vortex_array::arrays::slice::Slice::slice(array: vortex_array::ArrayView< pub struct vortex_array::arrays::Struct -impl vortex_array::arrays::Struct - -pub const vortex_array::arrays::Struct::ID: vortex_array::ArrayId - impl core::clone::Clone for vortex_array::arrays::Struct pub fn vortex_array::arrays::Struct::clone(&self) -> vortex_array::arrays::Struct @@ -6658,10 +6514,6 @@ pub struct vortex_array::arrays::VarBin impl vortex_array::arrays::VarBin -pub const vortex_array::arrays::VarBin::ID: vortex_array::ArrayId - -impl vortex_array::arrays::VarBin - pub fn vortex_array::arrays::VarBin::_slice(array: vortex_array::ArrayView<'_, vortex_array::arrays::VarBin>, range: core::ops::range::Range) -> vortex_error::VortexResult impl core::clone::Clone for vortex_array::arrays::VarBin @@ -6746,10 +6598,6 @@ pub fn vortex_array::arrays::VarBin::mask(array: vortex_array::ArrayView<'_, vor pub struct vortex_array::arrays::VarBinView -impl vortex_array::arrays::VarBinView - -pub const vortex_array::arrays::VarBinView::ID: vortex_array::ArrayId - impl core::clone::Clone for vortex_array::arrays::VarBinView pub fn vortex_array::arrays::VarBinView::clone(&self) -> vortex_array::arrays::VarBinView @@ -6828,10 +6676,6 @@ pub fn vortex_array::arrays::VarBinView::zip(if_true: vortex_array::ArrayView<'_ pub struct vortex_array::arrays::Variant -impl vortex_array::arrays::Variant - -pub const vortex_array::arrays::Variant::ID: vortex_array::ArrayId - impl core::clone::Clone for vortex_array::arrays::Variant pub fn vortex_array::arrays::Variant::clone(&self) -> vortex_array::arrays::Variant @@ -8832,7 +8676,7 @@ impl vortex_array::dtype::extensio pub fn V::deserialize(&self, data: &[u8], storage_dtype: vortex_array::dtype::DType) -> core::result::Result -pub fn V::id(&self) -> arcref::ArcRef +pub fn V::id(&self) -> vortex_session::registry::Id pub trait vortex_array::dtype::extension::ExtVTable: 'static + core::marker::Sized + core::marker::Send + core::marker::Sync + core::clone::Clone + core::fmt::Debug + core::cmp::Eq + core::hash::Hash @@ -8980,7 +8824,7 @@ pub fn V::try_match<'a>(ext_dtype: &'a vortex_array::dtype::extension::ExtDTypeR pub type vortex_array::dtype::extension::ExtDTypePluginRef = alloc::sync::Arc -pub type vortex_array::dtype::extension::ExtId = arcref::ArcRef +pub type vortex_array::dtype::extension::ExtId = vortex_session::registry::Id pub mod vortex_array::dtype::flatbuffers @@ -17800,7 +17644,7 @@ impl vortex_array::scalar_fn::Scalar pub fn V::deserialize(&self, metadata: &[u8], session: &vortex_session::VortexSession) -> core::result::Result -pub fn V::id(&self) -> arcref::ArcRef +pub fn V::id(&self) -> vortex_session::registry::Id pub trait vortex_array::scalar_fn::ScalarFnVTable: 'static + core::marker::Sized + core::clone::Clone + core::marker::Send + core::marker::Sync @@ -18624,7 +18468,7 @@ pub type vortex_array::scalar_fn::ChildName = arcref::ArcRef pub type vortex_array::scalar_fn::ReduceNodeRef = alloc::sync::Arc -pub type vortex_array::scalar_fn::ScalarFnId = arcref::ArcRef +pub type vortex_array::scalar_fn::ScalarFnId = vortex_session::registry::Id pub type vortex_array::scalar_fn::ScalarFnPluginRef = alloc::sync::Arc @@ -19422,7 +19266,7 @@ impl vortex_array::ArrayPlugin for V pub fn V::deserialize(&self, dtype: &vortex_array::dtype::DType, len: usize, metadata: &[u8], buffers: &[vortex_array::buffer::BufferHandle], children: &dyn vortex_array::serde::ArrayChildren, session: &vortex_session::VortexSession) -> core::result::Result -pub fn V::id(&self) -> arcref::ArcRef +pub fn V::id(&self) -> vortex_session::registry::Id pub fn V::is_supported_encoding(&self, id: &vortex_array::ArrayId) -> bool @@ -23080,9 +22924,9 @@ pub fn V::deserialize(&self, dtype: &vortex_array::dtype::DType, len: usize, met pub fn V::deserialize(&self, dtype: &vortex_array::dtype::DType, len: usize, metadata: &[u8], buffers: &[vortex_array::buffer::BufferHandle], children: &dyn vortex_array::serde::ArrayChildren, session: &vortex_session::VortexSession) -> core::result::Result -pub fn V::id(&self) -> arcref::ArcRef +pub fn V::id(&self) -> vortex_session::registry::Id -pub fn V::id(&self) -> arcref::ArcRef +pub fn V::id(&self) -> vortex_session::registry::Id pub fn V::is_supported_encoding(&self, id: &vortex_array::ArrayId) -> bool @@ -25340,7 +25184,7 @@ pub fn vortex_array::validity_to_child(validity: &vortex_array::validity::Validi pub type vortex_array::ArrayContext = vortex_session::registry::Context -pub type vortex_array::ArrayId = arcref::ArcRef +pub type vortex_array::ArrayId = vortex_session::registry::Id pub type vortex_array::ArrayPluginRef = alloc::sync::Arc diff --git a/vortex-array/src/aggregate_fn/accumulator.rs b/vortex-array/src/aggregate_fn/accumulator.rs index 00c80b38221..71ed56b3110 100644 --- a/vortex-array/src/aggregate_fn/accumulator.rs +++ b/vortex-array/src/aggregate_fn/accumulator.rs @@ -116,7 +116,7 @@ impl DynAccumulator for Accumulator { let kernels_r = kernels.read(); let batch_id = batch.encoding_id(); if let Some(result) = kernels_r - .get(&(batch_id.clone(), Some(self.aggregate_fn.id()))) + .get(&(batch_id, Some(self.aggregate_fn.id()))) .or_else(|| kernels_r.get(&(batch_id, None))) .and_then(|kernel| { kernel diff --git a/vortex-array/src/aggregate_fn/fns/count/mod.rs b/vortex-array/src/aggregate_fn/fns/count/mod.rs index f0617e96bfe..da12b85b0ee 100644 --- a/vortex-array/src/aggregate_fn/fns/count/mod.rs +++ b/vortex-array/src/aggregate_fn/fns/count/mod.rs @@ -27,7 +27,7 @@ impl AggregateFnVTable for Count { type Partial = u64; fn id(&self) -> AggregateFnId { - AggregateFnId::new_ref("vortex.count") + AggregateFnId::new("vortex.count") } fn serialize(&self, _options: &Self::Options) -> VortexResult>> { diff --git a/vortex-array/src/aggregate_fn/fns/first/mod.rs b/vortex-array/src/aggregate_fn/fns/first/mod.rs index 38e55607279..67affbd4fdc 100644 --- a/vortex-array/src/aggregate_fn/fns/first/mod.rs +++ b/vortex-array/src/aggregate_fn/fns/first/mod.rs @@ -40,7 +40,7 @@ impl AggregateFnVTable for First { type Partial = FirstPartial; fn id(&self) -> AggregateFnId { - AggregateFnId::new_ref("vortex.first") + AggregateFnId::new("vortex.first") } fn serialize(&self, _options: &Self::Options) -> VortexResult>> { diff --git a/vortex-array/src/aggregate_fn/fns/is_constant/mod.rs b/vortex-array/src/aggregate_fn/fns/is_constant/mod.rs index 4df47b770de..3edebb91333 100644 --- a/vortex-array/src/aggregate_fn/fns/is_constant/mod.rs +++ b/vortex-array/src/aggregate_fn/fns/is_constant/mod.rs @@ -256,7 +256,7 @@ impl AggregateFnVTable for IsConstant { type Partial = IsConstantPartial; fn id(&self) -> AggregateFnId { - AggregateFnId::new_ref("vortex.is_constant") + AggregateFnId::new("vortex.is_constant") } fn serialize(&self, _options: &Self::Options) -> VortexResult>> { diff --git a/vortex-array/src/aggregate_fn/fns/is_sorted/mod.rs b/vortex-array/src/aggregate_fn/fns/is_sorted/mod.rs index 780fc492baa..e68e74da63d 100644 --- a/vortex-array/src/aggregate_fn/fns/is_sorted/mod.rs +++ b/vortex-array/src/aggregate_fn/fns/is_sorted/mod.rs @@ -227,7 +227,7 @@ impl AggregateFnVTable for IsSorted { type Partial = IsSortedPartial; fn id(&self) -> AggregateFnId { - AggregateFnId::new_ref("vortex.is_sorted") + AggregateFnId::new("vortex.is_sorted") } fn serialize(&self, _options: &Self::Options) -> VortexResult>> { diff --git a/vortex-array/src/aggregate_fn/fns/last/mod.rs b/vortex-array/src/aggregate_fn/fns/last/mod.rs index 009b487ad2d..a1cbf032b88 100644 --- a/vortex-array/src/aggregate_fn/fns/last/mod.rs +++ b/vortex-array/src/aggregate_fn/fns/last/mod.rs @@ -40,7 +40,7 @@ impl AggregateFnVTable for Last { type Partial = LastPartial; fn id(&self) -> AggregateFnId { - AggregateFnId::new_ref("vortex.last") + AggregateFnId::new("vortex.last") } fn serialize(&self, _options: &Self::Options) -> VortexResult>> { diff --git a/vortex-array/src/aggregate_fn/fns/min_max/mod.rs b/vortex-array/src/aggregate_fn/fns/min_max/mod.rs index 91d178a4814..17e886b1efb 100644 --- a/vortex-array/src/aggregate_fn/fns/min_max/mod.rs +++ b/vortex-array/src/aggregate_fn/fns/min_max/mod.rs @@ -173,7 +173,7 @@ impl AggregateFnVTable for MinMax { type Partial = MinMaxPartial; fn id(&self) -> AggregateFnId { - AggregateFnId::new_ref("vortex.min_max") + AggregateFnId::new("vortex.min_max") } fn serialize(&self, _options: &Self::Options) -> VortexResult>> { diff --git a/vortex-array/src/aggregate_fn/fns/nan_count/mod.rs b/vortex-array/src/aggregate_fn/fns/nan_count/mod.rs index 9a1a8e4793b..602963cc385 100644 --- a/vortex-array/src/aggregate_fn/fns/nan_count/mod.rs +++ b/vortex-array/src/aggregate_fn/fns/nan_count/mod.rs @@ -81,7 +81,7 @@ impl AggregateFnVTable for NanCount { type Partial = u64; fn id(&self) -> AggregateFnId { - AggregateFnId::new_ref("vortex.nan_count") + AggregateFnId::new("vortex.nan_count") } fn serialize(&self, _options: &Self::Options) -> VortexResult>> { diff --git a/vortex-array/src/aggregate_fn/fns/sum/mod.rs b/vortex-array/src/aggregate_fn/fns/sum/mod.rs index 4d09eac4d5b..7b45aa65fa9 100644 --- a/vortex-array/src/aggregate_fn/fns/sum/mod.rs +++ b/vortex-array/src/aggregate_fn/fns/sum/mod.rs @@ -71,7 +71,7 @@ impl AggregateFnVTable for Sum { type Partial = SumPartial; fn id(&self) -> AggregateFnId { - AggregateFnId::new_ref("vortex.sum") + AggregateFnId::new("vortex.sum") } fn serialize(&self, _options: &Self::Options) -> VortexResult>> { diff --git a/vortex-array/src/aggregate_fn/foreign.rs b/vortex-array/src/aggregate_fn/foreign.rs index e79d2456493..26672cb23b7 100644 --- a/vortex-array/src/aggregate_fn/foreign.rs +++ b/vortex-array/src/aggregate_fn/foreign.rs @@ -54,7 +54,7 @@ impl AggregateFnVTable for ForeignAggregateFnVTable { type Partial = (); fn id(&self) -> AggregateFnId { - self.id.clone() + self.id } fn serialize(&self, options: &Self::Options) -> VortexResult>> { diff --git a/vortex-array/src/aggregate_fn/mod.rs b/vortex-array/src/aggregate_fn/mod.rs index a22006cb981..b697265e62b 100644 --- a/vortex-array/src/aggregate_fn/mod.rs +++ b/vortex-array/src/aggregate_fn/mod.rs @@ -6,7 +6,7 @@ //! This module contains the [`AggregateFnVTable`] trait, the [`Accumulator`] trait, and the //! type-erasure infrastructure for aggregate functions. -use arcref::ArcRef; +use vortex_session::registry::Id; mod accumulator; pub use accumulator::*; @@ -38,7 +38,7 @@ pub mod proto; pub mod session; /// A unique identifier for an aggregate function. -pub type AggregateFnId = ArcRef; +pub type AggregateFnId = Id; /// Private module to seal [`typed::DynAggregateFn`]. mod sealed { diff --git a/vortex-array/src/aggregate_fn/proto.rs b/vortex-array/src/aggregate_fn/proto.rs index dfb86ad0ed9..b0e7d9828ed 100644 --- a/vortex-array/src/aggregate_fn/proto.rs +++ b/vortex-array/src/aggregate_fn/proto.rs @@ -1,9 +1,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: Copyright the Vortex contributors -use std::sync::Arc; - -use arcref::ArcRef; use vortex_error::VortexResult; use vortex_error::vortex_bail; use vortex_error::vortex_err; @@ -38,11 +35,11 @@ impl AggregateFnRef { /// /// Note: the serialization format is not stable and may change between versions. pub fn from_proto(proto: &pb::AggregateFn, session: &VortexSession) -> VortexResult { - let agg_fn_id: AggregateFnId = ArcRef::new_arc(Arc::from(proto.id.as_str())); + let agg_fn_id: AggregateFnId = AggregateFnId::new(proto.id.as_str()); let agg_fn = if let Some(plugin) = session.aggregate_fns().registry().find(&agg_fn_id) { plugin.deserialize(proto.metadata(), session)? } else if session.allows_unknown() { - new_foreign_aggregate_fn(agg_fn_id.clone(), proto.metadata().to_vec()) + new_foreign_aggregate_fn(agg_fn_id, proto.metadata().to_vec()) } else { return Err(vortex_err!("unknown aggregate function id: {}", proto.id)); }; @@ -89,7 +86,7 @@ mod tests { type Partial = (); fn id(&self) -> AggregateFnId { - AggregateFnId::new_ref("vortex.test.proto") + AggregateFnId::new("vortex.test.proto") } fn serialize(&self, _options: &Self::Options) -> VortexResult>> { diff --git a/vortex-array/src/aggregate_fn/session.rs b/vortex-array/src/aggregate_fn/session.rs index 64e66195358..886b1ea9c2d 100644 --- a/vortex-array/src/aggregate_fn/session.rs +++ b/vortex-array/src/aggregate_fn/session.rs @@ -22,6 +22,7 @@ use crate::aggregate_fn::fns::sum::Sum; use crate::aggregate_fn::kernels::DynAggregateKernel; use crate::aggregate_fn::kernels::DynGroupedAggregateKernel; use crate::array::ArrayId; +use crate::array::VTable; use crate::arrays::Chunked; use crate::arrays::Dict; use crate::arrays::chunked::compute::aggregate::ChunkedArrayAggregate; @@ -61,10 +62,10 @@ impl Default for AggregateFnSession { this.register(Sum); // Register the built-in aggregate kernels. - this.register_aggregate_kernel(Chunked::ID, None, &ChunkedArrayAggregate); - this.register_aggregate_kernel(Dict::ID, Some(MinMax.id()), &DictMinMaxKernel); - this.register_aggregate_kernel(Dict::ID, Some(IsConstant.id()), &DictIsConstantKernel); - this.register_aggregate_kernel(Dict::ID, Some(IsSorted.id()), &DictIsSortedKernel); + this.register_aggregate_kernel(Chunked.id(), None::, &ChunkedArrayAggregate); + this.register_aggregate_kernel(Dict.id(), Some(MinMax.id()), &DictMinMaxKernel); + this.register_aggregate_kernel(Dict.id(), Some(IsConstant.id()), &DictIsConstantKernel); + this.register_aggregate_kernel(Dict.id(), Some(IsSorted.id()), &DictIsSortedKernel); this } @@ -86,11 +87,13 @@ impl AggregateFnSession { /// Register an aggregate function kernel for a specific aggregate function and array type. pub fn register_aggregate_kernel( &self, - array_id: ArrayId, - agg_fn_id: Option, + array_id: impl Into, + agg_fn_id: Option>, kernel: &'static dyn DynAggregateKernel, ) { - self.kernels.write().insert((array_id, agg_fn_id), kernel); + self.kernels + .write() + .insert((array_id.into(), agg_fn_id.map(|id| id.into())), kernel); } } diff --git a/vortex-array/src/array/foreign.rs b/vortex-array/src/array/foreign.rs index b29d76ba2b8..3233d2f4228 100644 --- a/vortex-array/src/array/foreign.rs +++ b/vortex-array/src/array/foreign.rs @@ -94,7 +94,7 @@ impl VTable for ForeignArray { type ValidityVTable = ForeignValidityVTable; fn id(&self) -> ArrayId { - self.id.clone() + self.id } fn validate( diff --git a/vortex-array/src/array/mod.rs b/vortex-array/src/array/mod.rs index 9ef3e57cab2..fae2d486ab6 100644 --- a/vortex-array/src/array/mod.rs +++ b/vortex-array/src/array/mod.rs @@ -7,7 +7,6 @@ use std::fmt::Formatter; use std::hash::Hash; use std::hash::Hasher; -use arcref::ArcRef; use vortex_buffer::ByteBuffer; use vortex_error::VortexExpect; use vortex_error::VortexResult; @@ -15,6 +14,7 @@ use vortex_error::vortex_ensure; use vortex_error::vortex_err; use vortex_error::vortex_panic; use vortex_session::VortexSession; +use vortex_session::registry::Id; use crate::ExecutionCtx; use crate::LEGACY_SESSION; @@ -510,4 +510,4 @@ impl Hasher for HasherWrapper<'_> { } /// ArrayId is a globally unique name for the array's vtable. -pub type ArrayId = ArcRef; +pub type ArrayId = Id; diff --git a/vortex-array/src/array/plugin.rs b/vortex-array/src/array/plugin.rs index f9411584f44..66845eb9a0a 100644 --- a/vortex-array/src/array/plugin.rs +++ b/vortex-array/src/array/plugin.rs @@ -1,6 +1,9 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: Copyright the Vortex contributors +use std::fmt; +use std::fmt::Debug; +use std::fmt::Formatter; use std::sync::Arc; use vortex_error::VortexResult; @@ -62,8 +65,8 @@ pub trait ArrayPlugin: 'static + Send + Sync { } } -impl std::fmt::Debug for dyn ArrayPlugin { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl Debug for dyn ArrayPlugin { + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { f.debug_tuple("ArrayPlugin").field(&self.id()).finish() } } diff --git a/vortex-array/src/arrays/bool/vtable/mod.rs b/vortex-array/src/arrays/bool/vtable/mod.rs index d02a8da22cf..44ba2204a85 100644 --- a/vortex-array/src/arrays/bool/vtable/mod.rs +++ b/vortex-array/src/arrays/bool/vtable/mod.rs @@ -30,6 +30,8 @@ mod kernel; mod operations; mod validity; +use vortex_session::registry::CachedId; + use crate::Precision; use crate::array::ArrayId; use crate::arrays::bool::compute::rules::RULES; @@ -66,7 +68,8 @@ impl VTable for Bool { type ValidityVTable = Self; fn id(&self) -> ArrayId { - Self::ID + static ID: CachedId = CachedId::new("vortex.bool"); + *ID } fn nbuffers(_array: ArrayView<'_, Self>) -> usize { @@ -190,10 +193,6 @@ impl VTable for Bool { #[derive(Clone, Debug)] pub struct Bool; -impl Bool { - pub const ID: ArrayId = ArrayId::new_ref("vortex.bool"); -} - #[cfg(test)] mod tests { use vortex_buffer::ByteBufferMut; diff --git a/vortex-array/src/arrays/chunked/vtable/mod.rs b/vortex-array/src/arrays/chunked/vtable/mod.rs index 29e4b397d35..c0bc63bfdb6 100644 --- a/vortex-array/src/arrays/chunked/vtable/mod.rs +++ b/vortex-array/src/arrays/chunked/vtable/mod.rs @@ -11,6 +11,7 @@ use vortex_error::vortex_ensure; use vortex_error::vortex_err; use vortex_error::vortex_panic; use vortex_session::VortexSession; +use vortex_session::registry::CachedId; use crate::ArrayEq; use crate::ArrayHash; @@ -48,10 +49,6 @@ pub type ChunkedArray = Array; #[derive(Clone, Debug)] pub struct Chunked; -impl Chunked { - pub const ID: ArrayId = ArrayId::new_ref("vortex.chunked"); -} - impl ArrayHash for ChunkedData { fn array_hash(&self, _state: &mut H, _precision: Precision) { // Chunk offsets are cached derived data. Slot 0 already stores the logical offsets array, @@ -72,9 +69,9 @@ impl VTable for Chunked { type OperationsVTable = Self; type ValidityVTable = Self; - fn id(&self) -> ArrayId { - Self::ID + static ID: CachedId = CachedId::new("vortex.chunked"); + *ID } fn validate( diff --git a/vortex-array/src/arrays/constant/vtable/mod.rs b/vortex-array/src/arrays/constant/vtable/mod.rs index d6f1c6ab2d3..9b4f9dbb953 100644 --- a/vortex-array/src/arrays/constant/vtable/mod.rs +++ b/vortex-array/src/arrays/constant/vtable/mod.rs @@ -11,6 +11,7 @@ use vortex_error::VortexResult; use vortex_error::vortex_ensure; use vortex_error::vortex_panic; use vortex_session::VortexSession; +use vortex_session::registry::CachedId; use crate::ArrayEq; use crate::ArrayHash; @@ -51,10 +52,6 @@ pub type ConstantArray = Array; #[derive(Clone, Debug)] pub struct Constant; -impl Constant { - pub const ID: ArrayId = ArrayId::new_ref("vortex.constant"); -} - impl ArrayHash for ConstantData { fn array_hash(&self, state: &mut H, _precision: Precision) { self.scalar.hash(state); @@ -74,7 +71,8 @@ impl VTable for Constant { type ValidityVTable = Self; fn id(&self) -> ArrayId { - Self::ID + static ID: CachedId = CachedId::new("vortex.constant"); + *ID } fn validate( diff --git a/vortex-array/src/arrays/decimal/vtable/mod.rs b/vortex-array/src/arrays/decimal/vtable/mod.rs index 1894466ed6b..4fce4915013 100644 --- a/vortex-array/src/arrays/decimal/vtable/mod.rs +++ b/vortex-array/src/arrays/decimal/vtable/mod.rs @@ -32,6 +32,8 @@ mod validity; use std::hash::Hash; +use vortex_session::registry::CachedId; + use crate::Precision; use crate::array::ArrayId; use crate::arrays::decimal::array::SLOT_NAMES; @@ -68,7 +70,8 @@ impl VTable for Decimal { type ValidityVTable = Self; fn id(&self) -> ArrayId { - Self::ID + static ID: CachedId = CachedId::new("vortex.decimal"); + *ID } fn nbuffers(_array: ArrayView<'_, Self>) -> usize { @@ -203,10 +206,6 @@ impl VTable for Decimal { #[derive(Clone, Debug)] pub struct Decimal; -impl Decimal { - pub const ID: ArrayId = ArrayId::new_ref("vortex.decimal"); -} - #[cfg(test)] mod tests { use vortex_buffer::ByteBufferMut; diff --git a/vortex-array/src/arrays/dict/compute/rules.rs b/vortex-array/src/arrays/dict/compute/rules.rs index c6817a39d58..bf148004af3 100644 --- a/vortex-array/src/arrays/dict/compute/rules.rs +++ b/vortex-array/src/arrays/dict/compute/rules.rs @@ -8,6 +8,7 @@ use crate::ArrayRef; use crate::IntoArray; use crate::Precision; use crate::array::ArrayView; +use crate::array::VTable; use crate::arrays::Constant; use crate::arrays::ConstantArray; use crate::arrays::Dict; @@ -80,7 +81,7 @@ impl ArrayParentReduceRule for DictionaryScalarFnValuesPushDownRule { tracing::trace!( "Not pushing down fallible scalar function {} over dictionary with sparse codes {}", parent.scalar_fn(), - Dict::ID, + Dict.id(), ); return Ok(None); } @@ -104,7 +105,7 @@ impl ArrayParentReduceRule for DictionaryScalarFnValuesPushDownRule { tracing::trace!( "Not pushing down null-sensitive scalar function {} over dictionary with null codes {}", parent.scalar_fn(), - Dict::ID, + Dict.id(), ); return Ok(None); } diff --git a/vortex-array/src/arrays/dict/vtable/mod.rs b/vortex-array/src/arrays/dict/vtable/mod.rs index b13374b9d8d..1fe15d5ce3d 100644 --- a/vortex-array/src/arrays/dict/vtable/mod.rs +++ b/vortex-array/src/arrays/dict/vtable/mod.rs @@ -12,6 +12,7 @@ use vortex_error::vortex_ensure; use vortex_error::vortex_err; use vortex_error::vortex_panic; use vortex_session::VortexSession; +use vortex_session::registry::CachedId; use super::DictData; use super::DictMetadata; @@ -52,10 +53,6 @@ pub type DictArray = Array; #[derive(Clone, Debug)] pub struct Dict; -impl Dict { - pub const ID: ArrayId = ArrayId::new_ref("vortex.dict"); -} - impl ArrayHash for DictData { fn array_hash(&self, _state: &mut H, _precision: Precision) {} } @@ -73,7 +70,8 @@ impl VTable for Dict { type ValidityVTable = Self; fn id(&self) -> ArrayId { - Self::ID + static ID: CachedId = CachedId::new("vortex.dict"); + *ID } fn validate( diff --git a/vortex-array/src/arrays/extension/compute/rules.rs b/vortex-array/src/arrays/extension/compute/rules.rs index af1cbc832b9..3f5295f729e 100644 --- a/vortex-array/src/arrays/extension/compute/rules.rs +++ b/vortex-array/src/arrays/extension/compute/rules.rs @@ -86,7 +86,7 @@ mod tests { type NativeValue<'a> = &'a str; fn id(&self) -> ExtId { - ExtId::new_ref("test_ext") + ExtId::new("test_ext") } fn serialize_metadata(&self, _metadata: &Self::Metadata) -> VortexResult> { @@ -182,7 +182,7 @@ mod tests { type NativeValue<'a> = &'a str; fn id(&self) -> ExtId { - ExtId::new_ref("test_ext_2") + ExtId::new("test_ext_2") } fn serialize_metadata(&self, _metadata: &Self::Metadata) -> VortexResult> { diff --git a/vortex-array/src/arrays/extension/vtable/mod.rs b/vortex-array/src/arrays/extension/vtable/mod.rs index ba403403dbe..b82d4b8e0df 100644 --- a/vortex-array/src/arrays/extension/vtable/mod.rs +++ b/vortex-array/src/arrays/extension/vtable/mod.rs @@ -14,6 +14,7 @@ use vortex_error::vortex_bail; use vortex_error::vortex_ensure; use vortex_error::vortex_panic; use vortex_session::VortexSession; +use vortex_session::registry::CachedId; use crate::ArrayEq; use crate::ArrayHash; @@ -54,7 +55,8 @@ impl VTable for Extension { type ValidityVTable = ValidityVTableFromChild; fn id(&self) -> ArrayId { - Self::ID + static ID: CachedId = CachedId::new("vortex.ext"); + *ID } fn nbuffers(_array: ArrayView<'_, Self>) -> usize { @@ -165,7 +167,3 @@ impl VTable for Extension { #[derive(Clone, Debug)] pub struct Extension; - -impl Extension { - pub const ID: ArrayId = ArrayId::new_ref("vortex.ext"); -} diff --git a/vortex-array/src/arrays/filter/vtable.rs b/vortex-array/src/arrays/filter/vtable.rs index 8eb7fb62213..05f49b5c941 100644 --- a/vortex-array/src/arrays/filter/vtable.rs +++ b/vortex-array/src/arrays/filter/vtable.rs @@ -11,6 +11,7 @@ use vortex_error::vortex_ensure; use vortex_error::vortex_panic; use vortex_mask::Mask; use vortex_session::VortexSession; +use vortex_session::registry::CachedId; use crate::AnyCanonical; use crate::ArrayEq; @@ -48,10 +49,6 @@ pub type FilterArray = Array; #[derive(Clone, Debug)] pub struct Filter; -impl Filter { - pub const ID: ArrayId = ArrayId::new_ref("vortex.filter"); -} - impl ArrayHash for FilterData { fn array_hash(&self, state: &mut H, precision: Precision) { self.mask.array_hash(state, precision); @@ -68,9 +65,9 @@ impl VTable for Filter { type ArrayData = FilterData; type OperationsVTable = Self; type ValidityVTable = Self; - fn id(&self) -> ArrayId { - Self::ID + static ID: CachedId = CachedId::new("vortex.filter"); + *ID } fn validate( 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 b2c02ec6891..a3724b06fca 100644 --- a/vortex-array/src/arrays/fixed_size_list/vtable/mod.rs +++ b/vortex-array/src/arrays/fixed_size_list/vtable/mod.rs @@ -11,6 +11,7 @@ use vortex_error::vortex_bail; use vortex_error::vortex_ensure; use vortex_error::vortex_panic; use vortex_session::VortexSession; +use vortex_session::registry::CachedId; use crate::ArrayEq; use crate::ArrayHash; @@ -40,10 +41,6 @@ pub type FixedSizeListArray = Array; #[derive(Clone, Debug)] pub struct FixedSizeList; -impl FixedSizeList { - pub const ID: ArrayId = ArrayId::new_ref("vortex.fixed_size_list"); -} - impl ArrayHash for FixedSizeListData { fn array_hash(&self, state: &mut H, precision: Precision) { let _precision = precision; @@ -63,9 +60,9 @@ impl VTable for FixedSizeList { type OperationsVTable = Self; type ValidityVTable = Self; - fn id(&self) -> ArrayId { - Self::ID + static ID: CachedId = CachedId::new("vortex.fixed_size_list"); + *ID } fn nbuffers(_array: ArrayView<'_, Self>) -> usize { diff --git a/vortex-array/src/arrays/list/vtable/mod.rs b/vortex-array/src/arrays/list/vtable/mod.rs index d9624f49560..8563c4ed27a 100644 --- a/vortex-array/src/arrays/list/vtable/mod.rs +++ b/vortex-array/src/arrays/list/vtable/mod.rs @@ -11,6 +11,7 @@ use vortex_error::vortex_bail; use vortex_error::vortex_ensure; use vortex_error::vortex_panic; use vortex_session::VortexSession; +use vortex_session::registry::CachedId; use crate::ArrayEq; use crate::ArrayHash; @@ -64,9 +65,9 @@ impl VTable for List { type OperationsVTable = Self; type ValidityVTable = Self; - fn id(&self) -> ArrayId { - Self::ID + static ID: CachedId = CachedId::new("vortex.list"); + *ID } fn nbuffers(_array: ArrayView<'_, Self>) -> usize { @@ -200,7 +201,3 @@ impl VTable for List { #[derive(Clone, Debug)] pub struct List; - -impl List { - pub const ID: ArrayId = ArrayId::new_ref("vortex.list"); -} diff --git a/vortex-array/src/arrays/listview/vtable/mod.rs b/vortex-array/src/arrays/listview/vtable/mod.rs index 6338c6504c1..893edb6bf71 100644 --- a/vortex-array/src/arrays/listview/vtable/mod.rs +++ b/vortex-array/src/arrays/listview/vtable/mod.rs @@ -12,6 +12,7 @@ use vortex_error::vortex_bail; use vortex_error::vortex_ensure; use vortex_error::vortex_panic; use vortex_session::VortexSession; +use vortex_session::registry::CachedId; use crate::ArrayEq; use crate::ArrayHash; @@ -42,10 +43,6 @@ pub type ListViewArray = Array; #[derive(Clone, Debug)] pub struct ListView; -impl ListView { - pub const ID: ArrayId = ArrayId::new_ref("vortex.listview"); -} - #[derive(Clone, prost::Message)] pub struct ListViewMetadata { #[prost(uint64, tag = "1")] @@ -73,9 +70,9 @@ impl VTable for ListView { type OperationsVTable = Self; type ValidityVTable = Self; - fn id(&self) -> ArrayId { - Self::ID + static ID: CachedId = CachedId::new("vortex.listview"); + *ID } fn nbuffers(_array: ArrayView<'_, Self>) -> usize { diff --git a/vortex-array/src/arrays/masked/vtable/mod.rs b/vortex-array/src/arrays/masked/vtable/mod.rs index cc5ef29a758..5f1f09e0644 100644 --- a/vortex-array/src/arrays/masked/vtable/mod.rs +++ b/vortex-array/src/arrays/masked/vtable/mod.rs @@ -12,6 +12,7 @@ use vortex_error::vortex_bail; use vortex_error::vortex_ensure; use vortex_error::vortex_panic; use vortex_session::VortexSession; +use vortex_session::registry::CachedId; use crate::AnyCanonical; use crate::ArrayEq; @@ -48,10 +49,6 @@ pub type MaskedArray = Array; #[derive(Clone, Debug)] pub struct Masked; -impl Masked { - pub const ID: ArrayId = ArrayId::new_ref("vortex.masked"); -} - impl ArrayHash for MaskedData { fn array_hash(&self, _state: &mut H, _precision: Precision) {} } @@ -69,7 +66,8 @@ impl VTable for Masked { type ValidityVTable = Self; fn id(&self) -> ArrayId { - Self::ID + static ID: CachedId = CachedId::new("vortex.masked"); + *ID } fn validate( diff --git a/vortex-array/src/arrays/null/mod.rs b/vortex-array/src/arrays/null/mod.rs index b2bdcc3a840..6e88b02aaf0 100644 --- a/vortex-array/src/arrays/null/mod.rs +++ b/vortex-array/src/arrays/null/mod.rs @@ -5,6 +5,7 @@ use vortex_error::VortexResult; use vortex_error::vortex_ensure; use vortex_error::vortex_panic; use vortex_session::VortexSession; +use vortex_session::registry::CachedId; use crate::ArrayRef; use crate::ExecutionCtx; @@ -36,7 +37,8 @@ impl VTable for Null { type ValidityVTable = Self; fn id(&self) -> ArrayId { - Self::ID + static ID: CachedId = CachedId::new("vortex.null"); + *ID } fn validate( @@ -139,10 +141,6 @@ impl VTable for Null { #[derive(Clone, Debug)] pub struct Null; -impl Null { - pub const ID: ArrayId = ArrayId::new_ref("vortex.null"); -} - impl Array { pub fn new(len: usize) -> Self { unsafe { diff --git a/vortex-array/src/arrays/patched/vtable/mod.rs b/vortex-array/src/arrays/patched/vtable/mod.rs index c49e681a411..5a1cdef3edf 100644 --- a/vortex-array/src/arrays/patched/vtable/mod.rs +++ b/vortex-array/src/arrays/patched/vtable/mod.rs @@ -17,6 +17,7 @@ use vortex_error::VortexExpect; use vortex_error::VortexResult; use vortex_error::vortex_panic; use vortex_session::VortexSession; +use vortex_session::registry::CachedId; use crate::ArrayRef; use crate::Canonical; @@ -99,7 +100,8 @@ impl VTable for Patched { type ValidityVTable = ValidityVTableFromChild; fn id(&self) -> ArrayId { - ArrayId::new_ref("vortex.patched") + static ID: CachedId = CachedId::new("vortex.patched"); + *ID } fn validate( diff --git a/vortex-array/src/arrays/primitive/vtable/mod.rs b/vortex-array/src/arrays/primitive/vtable/mod.rs index 806c95b6a8f..c1cdfc20d28 100644 --- a/vortex-array/src/arrays/primitive/vtable/mod.rs +++ b/vortex-array/src/arrays/primitive/vtable/mod.rs @@ -27,6 +27,7 @@ use std::hash::Hasher; use vortex_buffer::Alignment; use vortex_session::VortexSession; +use vortex_session::registry::CachedId; use crate::Precision; use crate::array::ArrayId; @@ -57,7 +58,8 @@ impl VTable for Primitive { type ValidityVTable = Self; fn id(&self) -> ArrayId { - Self::ID + static ID: CachedId = CachedId::new("vortex.primitive"); + *ID } fn nbuffers(_array: ArrayView<'_, Self>) -> usize { @@ -203,10 +205,6 @@ impl VTable for Primitive { #[derive(Clone, Debug)] pub struct Primitive; -impl Primitive { - pub const ID: ArrayId = ArrayId::new_ref("vortex.primitive"); -} - #[cfg(test)] mod tests { use vortex_buffer::ByteBufferMut; diff --git a/vortex-array/src/arrays/scalar_fn/vtable/mod.rs b/vortex-array/src/arrays/scalar_fn/vtable/mod.rs index c663ddfc64e..3f70088966b 100644 --- a/vortex-array/src/arrays/scalar_fn/vtable/mod.rs +++ b/vortex-array/src/arrays/scalar_fn/vtable/mod.rs @@ -71,7 +71,7 @@ impl VTable for ScalarFnVTable { type ValidityVTable = Self; fn id(&self) -> ArrayId { - self.id.clone() + self.id } fn validate( @@ -284,7 +284,7 @@ impl scalar_fn::ScalarFnVTable for ArrayExpr { type Options = FakeEq; fn id(&self) -> ScalarFnId { - ScalarFnId::from("vortex.array") + ScalarFnId::new("vortex.array") } fn arity(&self, _options: &Self::Options) -> Arity { diff --git a/vortex-array/src/arrays/shared/vtable.rs b/vortex-array/src/arrays/shared/vtable.rs index 6be759c83eb..3f67738684d 100644 --- a/vortex-array/src/arrays/shared/vtable.rs +++ b/vortex-array/src/arrays/shared/vtable.rs @@ -7,6 +7,7 @@ use vortex_error::VortexExpect; use vortex_error::VortexResult; use vortex_error::vortex_panic; use vortex_session::VortexSession; +use vortex_session::registry::CachedId; use crate::ArrayEq; use crate::ArrayHash; @@ -37,10 +38,6 @@ pub type SharedArray = Array; #[derive(Clone, Debug)] pub struct Shared; -impl Shared { - pub const ID: ArrayId = ArrayId::new_ref("vortex.shared"); -} - impl ArrayHash for SharedData { fn array_hash(&self, _state: &mut H, _precision: Precision) {} } @@ -55,9 +52,9 @@ impl VTable for Shared { type ArrayData = SharedData; type OperationsVTable = Self; type ValidityVTable = Self; - fn id(&self) -> ArrayId { - Self::ID + static ID: CachedId = CachedId::new("vortex.shared"); + *ID } fn validate( diff --git a/vortex-array/src/arrays/slice/vtable.rs b/vortex-array/src/arrays/slice/vtable.rs index 2ac41a358b9..911de401aa4 100644 --- a/vortex-array/src/arrays/slice/vtable.rs +++ b/vortex-array/src/arrays/slice/vtable.rs @@ -13,6 +13,7 @@ use vortex_error::vortex_bail; use vortex_error::vortex_ensure; use vortex_error::vortex_panic; use vortex_session::VortexSession; +use vortex_session::registry::CachedId; use crate::AnyCanonical; use crate::ArrayEq; @@ -45,10 +46,6 @@ pub type SliceArray = Array; #[derive(Clone, Debug)] pub struct Slice; -impl Slice { - pub const ID: ArrayId = ArrayId::new_ref("vortex.slice"); -} - impl ArrayHash for SliceData { fn array_hash(&self, state: &mut H, _precision: Precision) { self.range.start.hash(state); @@ -66,9 +63,9 @@ impl VTable for Slice { type ArrayData = SliceData; type OperationsVTable = Self; type ValidityVTable = Self; - fn id(&self) -> ArrayId { - Slice::ID + static ID: CachedId = CachedId::new("vortex.slice"); + *ID } fn validate( diff --git a/vortex-array/src/arrays/struct_/vtable/mod.rs b/vortex-array/src/arrays/struct_/vtable/mod.rs index f33cea360c3..5da40b56f24 100644 --- a/vortex-array/src/arrays/struct_/vtable/mod.rs +++ b/vortex-array/src/arrays/struct_/vtable/mod.rs @@ -29,6 +29,8 @@ mod kernel; mod operations; mod validity; +use vortex_session::registry::CachedId; + use crate::array::ArrayId; /// A [`Struct`]-encoded Vortex array. @@ -39,9 +41,9 @@ impl VTable for Struct { type OperationsVTable = Self; type ValidityVTable = Self; - fn id(&self) -> ArrayId { - Self::ID + static ID: CachedId = CachedId::new("vortex.struct"); + *ID } fn nbuffers(_array: ArrayView<'_, Self>) -> usize { @@ -205,7 +207,3 @@ impl VTable for Struct { #[derive(Clone, Debug)] pub struct Struct; - -impl Struct { - pub const ID: ArrayId = ArrayId::new_ref("vortex.struct"); -} diff --git a/vortex-array/src/arrays/varbin/vtable/mod.rs b/vortex-array/src/arrays/varbin/vtable/mod.rs index ffe44158c27..b72ac5eaa48 100644 --- a/vortex-array/src/arrays/varbin/vtable/mod.rs +++ b/vortex-array/src/arrays/varbin/vtable/mod.rs @@ -9,6 +9,7 @@ use vortex_error::VortexResult; use vortex_error::vortex_bail; use vortex_error::vortex_ensure; use vortex_error::vortex_panic; +use vortex_session::registry::CachedId; use crate::ArrayRef; use crate::ExecutionCtx; @@ -68,9 +69,9 @@ impl VTable for VarBin { type OperationsVTable = Self; type ValidityVTable = Self; - fn id(&self) -> ArrayId { - Self::ID + static ID: CachedId = CachedId::new("vortex.varbin"); + *ID } fn nbuffers(_array: ArrayView<'_, Self>) -> usize { @@ -198,7 +199,3 @@ impl VTable for VarBin { #[derive(Clone, Debug)] pub struct VarBin; - -impl VarBin { - pub const ID: ArrayId = ArrayId::new_ref("vortex.varbin"); -} diff --git a/vortex-array/src/arrays/varbinview/vtable/mod.rs b/vortex-array/src/arrays/varbinview/vtable/mod.rs index 453cd7b61d4..3827549744c 100644 --- a/vortex-array/src/arrays/varbinview/vtable/mod.rs +++ b/vortex-array/src/arrays/varbinview/vtable/mod.rs @@ -13,6 +13,7 @@ use vortex_error::vortex_ensure; use vortex_error::vortex_err; use vortex_error::vortex_panic; use vortex_session::VortexSession; +use vortex_session::registry::CachedId; use crate::ArrayRef; use crate::ExecutionCtx; @@ -42,10 +43,6 @@ pub type VarBinViewArray = Array; #[derive(Clone, Debug)] pub struct VarBinView; -impl VarBinView { - pub const ID: ArrayId = ArrayId::new_ref("vortex.varbinview"); -} - impl ArrayHash for VarBinViewData { fn array_hash(&self, state: &mut H, precision: Precision) { for buffer in self.buffers.iter() { @@ -74,7 +71,8 @@ impl VTable for VarBinView { type ValidityVTable = Self; fn id(&self) -> ArrayId { - Self::ID + static ID: CachedId = CachedId::new("vortex.varbinview"); + *ID } fn nbuffers(array: ArrayView<'_, Self>) -> usize { diff --git a/vortex-array/src/arrays/variant/vtable/mod.rs b/vortex-array/src/arrays/variant/vtable/mod.rs index 2fdf200b98f..25db7e16077 100644 --- a/vortex-array/src/arrays/variant/vtable/mod.rs +++ b/vortex-array/src/arrays/variant/vtable/mod.rs @@ -9,6 +9,7 @@ use vortex_error::VortexResult; use vortex_error::vortex_ensure; use vortex_error::vortex_panic; use vortex_session::VortexSession; +use vortex_session::registry::CachedId; use crate::ArrayRef; use crate::ExecutionCtx; @@ -29,10 +30,6 @@ pub type VariantArray = Array; #[derive(Clone, Debug)] pub struct Variant; -impl Variant { - pub const ID: ArrayId = ArrayId::new_ref("vortex.variant"); -} - impl VTable for Variant { type ArrayData = EmptyArrayData; @@ -41,7 +38,8 @@ impl VTable for Variant { type ValidityVTable = Self; fn id(&self) -> ArrayId { - Self::ID + static ID: CachedId = CachedId::new("vortex.variant"); + *ID } fn validate( diff --git a/vortex-array/src/dtype/extension/foreign.rs b/vortex-array/src/dtype/extension/foreign.rs index 7753a5b6b86..b7636225ff9 100644 --- a/vortex-array/src/dtype/extension/foreign.rs +++ b/vortex-array/src/dtype/extension/foreign.rs @@ -51,7 +51,7 @@ impl ExtVTable for ForeignExtDType { type NativeValue<'a> = &'a ScalarValue; fn id(&self) -> ExtId { - self.id.clone() + self.id } fn serialize_metadata(&self, metadata: &Self::Metadata) -> VortexResult> { diff --git a/vortex-array/src/dtype/extension/mod.rs b/vortex-array/src/dtype/extension/mod.rs index 0eae1587b40..96dfa7e22a3 100644 --- a/vortex-array/src/dtype/extension/mod.rs +++ b/vortex-array/src/dtype/extension/mod.rs @@ -30,9 +30,10 @@ pub use erased::*; mod matcher; pub use matcher::*; +use vortex_session::registry::Id; /// A unique identifier for an extension type -pub type ExtId = arcref::ArcRef; +pub type ExtId = Id; /// Private module to seal [`typed::DynExtDType`]. mod sealed { diff --git a/vortex-array/src/dtype/serde/flatbuffers.rs b/vortex-array/src/dtype/serde/flatbuffers.rs index af7ed7b8af3..ea4470039f1 100644 --- a/vortex-array/src/dtype/serde/flatbuffers.rs +++ b/vortex-array/src/dtype/serde/flatbuffers.rs @@ -195,13 +195,10 @@ impl TryFrom for DType { let fb_ext = fb .type__as_extension() .ok_or_else(|| vortex_err!("failed to parse extension from flatbuffer"))?; - let id = ExtId::new_arc( - fb_ext - .id() - .ok_or_else(|| vortex_err!("failed to parse extension id from flatbuffer"))? - .to_string() - .into(), - ); + let id = + ExtId::new(fb_ext.id().ok_or_else(|| { + vortex_err!("failed to parse extension id from flatbuffer") + })?); let storage_dtype = fb_ext.storage_dtype().ok_or_else(|| { vortex_err!( Serde: "storage_dtype must be present on DType fbs message") diff --git a/vortex-array/src/dtype/serde/proto.rs b/vortex-array/src/dtype/serde/proto.rs index 4ca8642120b..1dfe60f522e 100644 --- a/vortex-array/src/dtype/serde/proto.rs +++ b/vortex-array/src/dtype/serde/proto.rs @@ -87,7 +87,7 @@ impl DType { )) } DtypeType::Extension(e) => { - let id = ExtId::new_arc(e.id.as_str().to_string().into()); + let id = ExtId::new(e.id.as_str()); let storage_dtype = DType::from_proto( e.storage_dtype .as_ref() diff --git a/vortex-array/src/dtype/serde/serde.rs b/vortex-array/src/dtype/serde/serde.rs index e89a1a98658..1f7ea6fc2ca 100644 --- a/vortex-array/src/dtype/serde/serde.rs +++ b/vortex-array/src/dtype/serde/serde.rs @@ -571,7 +571,7 @@ impl<'de> DeserializeSeed<'de> for DTypeSerde<'_, ExtDTypeRef> { } let id = id.ok_or_else(|| de::Error::missing_field("id"))?; - let id = ExtId::new_arc(id); + let id = ExtId::new(&id); let storage_dtype = storage_dtype.ok_or_else(|| de::Error::missing_field("storage_dtype"))?; let metadata = metadata.ok_or_else(|| de::Error::missing_field("metadata"))?; diff --git a/vortex-array/src/expr/proto.rs b/vortex-array/src/expr/proto.rs index 22c5aa8b467..27859235e88 100644 --- a/vortex-array/src/expr/proto.rs +++ b/vortex-array/src/expr/proto.rs @@ -1,8 +1,6 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: Copyright the Vortex contributors -use std::sync::Arc; - use itertools::Itertools; use vortex_error::VortexResult; use vortex_error::vortex_err; @@ -41,7 +39,7 @@ impl ExprSerializeProtoExt for Expression { impl Expression { pub fn from_proto(expr: &pb::Expr, session: &VortexSession) -> VortexResult { - let expr_id = ScalarFnId::new_arc(Arc::from(expr.id.to_string())); + let expr_id = ScalarFnId::new(expr.id.as_str()); let children = expr .children .iter() diff --git a/vortex-array/src/extension/datetime/date.rs b/vortex-array/src/extension/datetime/date.rs index a0434b3ebc5..8f3ae954535 100644 --- a/vortex-array/src/extension/datetime/date.rs +++ b/vortex-array/src/extension/datetime/date.rs @@ -79,7 +79,7 @@ impl ExtVTable for Date { type NativeValue<'a> = DateValue; fn id(&self) -> ExtId { - ExtId::new_ref("vortex.date") + ExtId::new("vortex.date") } fn serialize_metadata(&self, metadata: &Self::Metadata) -> VortexResult> { diff --git a/vortex-array/src/extension/datetime/time.rs b/vortex-array/src/extension/datetime/time.rs index 08c43e9e20c..d3a62b5ef65 100644 --- a/vortex-array/src/extension/datetime/time.rs +++ b/vortex-array/src/extension/datetime/time.rs @@ -80,7 +80,7 @@ impl ExtVTable for Time { type NativeValue<'a> = TimeValue; fn id(&self) -> ExtId { - ExtId::new_ref("vortex.time") + ExtId::new("vortex.time") } fn serialize_metadata(&self, metadata: &Self::Metadata) -> VortexResult> { diff --git a/vortex-array/src/extension/datetime/timestamp.rs b/vortex-array/src/extension/datetime/timestamp.rs index b33571ed40e..ab65ce8b84c 100644 --- a/vortex-array/src/extension/datetime/timestamp.rs +++ b/vortex-array/src/extension/datetime/timestamp.rs @@ -114,7 +114,7 @@ impl ExtVTable for Timestamp { type NativeValue<'a> = TimestampValue<'a>; fn id(&self) -> ExtId { - ExtId::new_ref("vortex.timestamp") + ExtId::new("vortex.timestamp") } // NOTE(ngates): unfortunately we're stuck with this hand-rolled serialization format for diff --git a/vortex-array/src/extension/tests/divisible_int.rs b/vortex-array/src/extension/tests/divisible_int.rs index 8b9612e9438..4ab08f7b9f5 100644 --- a/vortex-array/src/extension/tests/divisible_int.rs +++ b/vortex-array/src/extension/tests/divisible_int.rs @@ -35,7 +35,7 @@ impl ExtVTable for DivisibleInt { type NativeValue<'a> = u64; fn id(&self) -> ExtId { - ExtId::new_ref("test.divisible_int") + ExtId::new("test.divisible_int") } fn serialize_metadata(&self, metadata: &Self::Metadata) -> VortexResult> { diff --git a/vortex-array/src/extension/uuid/vtable.rs b/vortex-array/src/extension/uuid/vtable.rs index c76c7352942..283de266684 100644 --- a/vortex-array/src/extension/uuid/vtable.rs +++ b/vortex-array/src/extension/uuid/vtable.rs @@ -27,7 +27,7 @@ impl ExtVTable for Uuid { type NativeValue<'a> = uuid::Uuid; fn id(&self) -> ExtId { - ExtId::new_ref("vortex.uuid") + ExtId::new("vortex.uuid") } fn serialize_metadata(&self, metadata: &Self::Metadata) -> VortexResult> { diff --git a/vortex-array/src/normalize.rs b/vortex-array/src/normalize.rs index 3235a480809..f4c1d8c5a8f 100644 --- a/vortex-array/src/normalize.rs +++ b/vortex-array/src/normalize.rs @@ -105,6 +105,7 @@ mod tests { use crate::ArrayRef; use crate::ExecutionCtx; use crate::IntoArray; + use crate::array::VTable; use crate::arrays::Dict; use crate::arrays::DictArray; use crate::arrays::Primitive; @@ -203,22 +204,18 @@ mod tests { // Slice the dict array to get a SliceArray wrapping a DictArray. let sliced = SliceArray::new(dict, 1..4).into_array(); - assert_eq!(sliced.encoding_id(), Slice::ID); + assert_eq!(sliced.encoding_id(), Slice.id()); - let allowed = HashSet::from_iter([Dict::ID, Primitive::ID]); + let allowed = HashSet::from_iter([Dict.id(), Primitive.id()]); let mut ctx = ExecutionCtx::new(VortexSession::empty()); - println!("sliced {}", sliced.display_tree()); - let normalized = sliced.normalize(&mut NormalizeOptions { allowed: &allowed, operation: Operation::Execute(&mut ctx), })?; - println!("after {}", normalized.display_tree()); - // The normalized result should be a DictArray, not a SliceArray. - assert_eq!(normalized.encoding_id(), Dict::ID); + assert_eq!(normalized.encoding_id(), Dict.id()); assert_eq!(normalized.len(), 3); // Verify the data: codes [1,0,1] -> values [20, 10, 20] diff --git a/vortex-array/src/scalar/arrow.rs b/vortex-array/src/scalar/arrow.rs index 73142281b0d..811417144f3 100644 --- a/vortex-array/src/scalar/arrow.rs +++ b/vortex-array/src/scalar/arrow.rs @@ -455,7 +455,7 @@ mod tests { type NativeValue<'a> = &'a str; fn id(&self) -> ExtId { - ExtId::new_ref("some_ext") + ExtId::new("some_ext") } fn serialize_metadata(&self, _options: &Self::Metadata) -> VortexResult> { diff --git a/vortex-array/src/scalar/tests/casting.rs b/vortex-array/src/scalar/tests/casting.rs index 4e6ecdd60b9..b73d4c83818 100644 --- a/vortex-array/src/scalar/tests/casting.rs +++ b/vortex-array/src/scalar/tests/casting.rs @@ -32,7 +32,7 @@ mod tests { type NativeValue<'a> = &'a str; fn id(&self) -> ExtId { - ExtId::new_ref("apples") + ExtId::new("apples") } fn serialize_metadata(&self, _metadata: &Self::Metadata) -> VortexResult> { @@ -247,7 +247,7 @@ mod tests { type NativeValue<'a> = &'a str; fn id(&self) -> ExtId { - ExtId::new_ref("f16_ext") + ExtId::new("f16_ext") } fn serialize_metadata(&self, _metadata: &Self::Metadata) -> VortexResult> { @@ -304,7 +304,7 @@ mod tests { type NativeValue<'a> = &'a str; fn id(&self) -> ExtId { - ExtId::new_ref("struct_ext") + ExtId::new("struct_ext") } fn serialize_metadata(&self, _metadata: &Self::Metadata) -> VortexResult> { diff --git a/vortex-array/src/scalar/typed_view/extension/tests.rs b/vortex-array/src/scalar/typed_view/extension/tests.rs index 5faa9550402..909f8a4b11a 100644 --- a/vortex-array/src/scalar/typed_view/extension/tests.rs +++ b/vortex-array/src/scalar/typed_view/extension/tests.rs @@ -21,7 +21,7 @@ impl ExtVTable for TestI32Ext { type NativeValue<'a> = &'a str; fn id(&self) -> ExtId { - ExtId::new_ref("test_ext") + ExtId::new("test_ext") } fn serialize_metadata(&self, _metadata: &Self::Metadata) -> VortexResult> { @@ -104,7 +104,7 @@ fn test_ext_scalar_partial_ord_different_types() { type NativeValue<'a> = &'a str; fn id(&self) -> ExtId { - ExtId::new_ref("test_ext_2") + ExtId::new("test_ext_2") } fn serialize_metadata(&self, _metadata: &Self::Metadata) -> VortexResult> { @@ -286,7 +286,7 @@ fn test_ext_scalar_with_metadata() { type NativeValue<'a> = &'a str; fn id(&self) -> ExtId { - ExtId::new_ref("test_ext_metadata") + ExtId::new("test_ext_metadata") } fn serialize_metadata(&self, _metadata: &Self::Metadata) -> VortexResult> { diff --git a/vortex-array/src/scalar_fn/fns/between/mod.rs b/vortex-array/src/scalar_fn/fns/between/mod.rs index aaec8108808..9061b829b7c 100644 --- a/vortex-array/src/scalar_fn/fns/between/mod.rs +++ b/vortex-array/src/scalar_fn/fns/between/mod.rs @@ -185,7 +185,7 @@ impl ScalarFnVTable for Between { type Options = BetweenOptions; fn id(&self) -> ScalarFnId { - ScalarFnId::from("vortex.between") + ScalarFnId::new("vortex.between") } fn serialize(&self, instance: &Self::Options) -> VortexResult>> { diff --git a/vortex-array/src/scalar_fn/fns/binary/mod.rs b/vortex-array/src/scalar_fn/fns/binary/mod.rs index 83385268397..1dce67e6679 100644 --- a/vortex-array/src/scalar_fn/fns/binary/mod.rs +++ b/vortex-array/src/scalar_fn/fns/binary/mod.rs @@ -52,7 +52,7 @@ impl ScalarFnVTable for Binary { type Options = Operator; fn id(&self) -> ScalarFnId { - ScalarFnId::from("vortex.binary") + ScalarFnId::new("vortex.binary") } fn serialize(&self, instance: &Self::Options) -> VortexResult>> { diff --git a/vortex-array/src/scalar_fn/fns/case_when.rs b/vortex-array/src/scalar_fn/fns/case_when.rs index f30a17ee580..f88dbdaf356 100644 --- a/vortex-array/src/scalar_fn/fns/case_when.rs +++ b/vortex-array/src/scalar_fn/fns/case_when.rs @@ -79,7 +79,7 @@ impl ScalarFnVTable for CaseWhen { type Options = CaseWhenOptions; fn id(&self) -> ScalarFnId { - ScalarFnId::from("vortex.case_when") + ScalarFnId::new("vortex.case_when") } fn serialize(&self, _options: &Self::Options) -> VortexResult>> { diff --git a/vortex-array/src/scalar_fn/fns/cast/mod.rs b/vortex-array/src/scalar_fn/fns/cast/mod.rs index 66a257d340b..4bb21961552 100644 --- a/vortex-array/src/scalar_fn/fns/cast/mod.rs +++ b/vortex-array/src/scalar_fn/fns/cast/mod.rs @@ -53,7 +53,7 @@ impl ScalarFnVTable for Cast { type Options = DType; fn id(&self) -> ScalarFnId { - ScalarFnId::from("vortex.cast") + ScalarFnId::new("vortex.cast") } fn serialize(&self, dtype: &DType) -> VortexResult>> { diff --git a/vortex-array/src/scalar_fn/fns/fill_null/mod.rs b/vortex-array/src/scalar_fn/fns/fill_null/mod.rs index 656029bf82d..16557cd77db 100644 --- a/vortex-array/src/scalar_fn/fns/fill_null/mod.rs +++ b/vortex-array/src/scalar_fn/fns/fill_null/mod.rs @@ -39,7 +39,7 @@ impl ScalarFnVTable for FillNull { type Options = EmptyOptions; fn id(&self) -> ScalarFnId { - ScalarFnId::from("vortex.fill_null") + ScalarFnId::new("vortex.fill_null") } fn serialize(&self, _options: &Self::Options) -> VortexResult>> { diff --git a/vortex-array/src/scalar_fn/fns/get_item.rs b/vortex-array/src/scalar_fn/fns/get_item.rs index 353ebc0925b..0b562420945 100644 --- a/vortex-array/src/scalar_fn/fns/get_item.rs +++ b/vortex-array/src/scalar_fn/fns/get_item.rs @@ -44,7 +44,7 @@ impl ScalarFnVTable for GetItem { type Options = FieldName; fn id(&self) -> ScalarFnId { - ScalarFnId::from("vortex.get_item") + ScalarFnId::new("vortex.get_item") } fn serialize(&self, instance: &Self::Options) -> VortexResult>> { diff --git a/vortex-array/src/scalar_fn/fns/is_not_null.rs b/vortex-array/src/scalar_fn/fns/is_not_null.rs index fd0dcc53fc6..b008ebb5835 100644 --- a/vortex-array/src/scalar_fn/fns/is_not_null.rs +++ b/vortex-array/src/scalar_fn/fns/is_not_null.rs @@ -35,7 +35,7 @@ impl ScalarFnVTable for IsNotNull { type Options = EmptyOptions; fn id(&self) -> ScalarFnId { - ScalarFnId::new_ref("vortex.is_not_null") + ScalarFnId::new("vortex.is_not_null") } fn serialize(&self, _instance: &Self::Options) -> VortexResult>> { diff --git a/vortex-array/src/scalar_fn/fns/like/mod.rs b/vortex-array/src/scalar_fn/fns/like/mod.rs index da52f730061..2288812b940 100644 --- a/vortex-array/src/scalar_fn/fns/like/mod.rs +++ b/vortex-array/src/scalar_fn/fns/like/mod.rs @@ -62,7 +62,7 @@ impl ScalarFnVTable for Like { type Options = LikeOptions; fn id(&self) -> ScalarFnId { - ScalarFnId::from("vortex.like") + ScalarFnId::new("vortex.like") } fn serialize(&self, instance: &Self::Options) -> VortexResult>> { diff --git a/vortex-array/src/scalar_fn/fns/list_contains/mod.rs b/vortex-array/src/scalar_fn/fns/list_contains/mod.rs index b4d6c3e6bc4..331f57874f0 100644 --- a/vortex-array/src/scalar_fn/fns/list_contains/mod.rs +++ b/vortex-array/src/scalar_fn/fns/list_contains/mod.rs @@ -60,7 +60,7 @@ impl ScalarFnVTable for ListContains { type Options = EmptyOptions; fn id(&self) -> ScalarFnId { - ScalarFnId::from("vortex.list.contains") + ScalarFnId::new("vortex.list.contains") } fn serialize(&self, _instance: &Self::Options) -> VortexResult>> { diff --git a/vortex-array/src/scalar_fn/fns/mask/mod.rs b/vortex-array/src/scalar_fn/fns/mask/mod.rs index eaf83307b35..cce76412fa6 100644 --- a/vortex-array/src/scalar_fn/fns/mask/mod.rs +++ b/vortex-array/src/scalar_fn/fns/mask/mod.rs @@ -46,7 +46,7 @@ impl ScalarFnVTable for Mask { type Options = EmptyOptions; fn id(&self) -> ScalarFnId { - ScalarFnId::from("vortex.mask") + ScalarFnId::new("vortex.mask") } fn serialize(&self, _options: &Self::Options) -> VortexResult>> { diff --git a/vortex-array/src/scalar_fn/fns/not/mod.rs b/vortex-array/src/scalar_fn/fns/not/mod.rs index c70c8794fe6..bdf7fdd9e76 100644 --- a/vortex-array/src/scalar_fn/fns/not/mod.rs +++ b/vortex-array/src/scalar_fn/fns/not/mod.rs @@ -36,7 +36,7 @@ impl ScalarFnVTable for Not { type Options = EmptyOptions; fn id(&self) -> ScalarFnId { - ScalarFnId::from("vortex.not") + ScalarFnId::new("vortex.not") } fn serialize(&self, _options: &Self::Options) -> VortexResult>> { diff --git a/vortex-array/src/scalar_fn/fns/root.rs b/vortex-array/src/scalar_fn/fns/root.rs index 7e04746db19..99bb6fecf6e 100644 --- a/vortex-array/src/scalar_fn/fns/root.rs +++ b/vortex-array/src/scalar_fn/fns/root.rs @@ -30,7 +30,7 @@ impl ScalarFnVTable for Root { type Options = EmptyOptions; fn id(&self) -> ScalarFnId { - ScalarFnId::from("vortex.root") + ScalarFnId::new("vortex.root") } fn serialize(&self, _instance: &Self::Options) -> VortexResult>> { diff --git a/vortex-array/src/scalar_fn/fns/select.rs b/vortex-array/src/scalar_fn/fns/select.rs index 2f93df5e789..c08f88f23cb 100644 --- a/vortex-array/src/scalar_fn/fns/select.rs +++ b/vortex-array/src/scalar_fn/fns/select.rs @@ -94,7 +94,7 @@ impl ScalarFnVTable for Select { fn child_name(&self, _instance: &FieldSelection, child_idx: usize) -> ChildName { match child_idx { - 0 => ChildName::new_ref("child"), + 0 => ChildName::from("child"), _ => unreachable!(), } } diff --git a/vortex-array/src/scalar_fn/fns/zip/mod.rs b/vortex-array/src/scalar_fn/fns/zip/mod.rs index 5de3524be9a..54949ef5d70 100644 --- a/vortex-array/src/scalar_fn/fns/zip/mod.rs +++ b/vortex-array/src/scalar_fn/fns/zip/mod.rs @@ -46,7 +46,7 @@ impl ScalarFnVTable for Zip { type Options = EmptyOptions; fn id(&self) -> ScalarFnId { - ScalarFnId::from("vortex.zip") + ScalarFnId::new("vortex.zip") } fn serialize(&self, _options: &Self::Options) -> VortexResult>> { diff --git a/vortex-array/src/scalar_fn/foreign.rs b/vortex-array/src/scalar_fn/foreign.rs index e7d3ee641cc..5cf896c129d 100644 --- a/vortex-array/src/scalar_fn/foreign.rs +++ b/vortex-array/src/scalar_fn/foreign.rs @@ -66,7 +66,7 @@ impl ScalarFnVTable for ForeignScalarFnVTable { type Options = ForeignScalarFnOptions; fn id(&self) -> ScalarFnId { - self.id.clone() + self.id } fn serialize(&self, options: &Self::Options) -> VortexResult>> { diff --git a/vortex-array/src/scalar_fn/mod.rs b/vortex-array/src/scalar_fn/mod.rs index 39e45f00e08..ce00fc08358 100644 --- a/vortex-array/src/scalar_fn/mod.rs +++ b/vortex-array/src/scalar_fn/mod.rs @@ -7,7 +7,7 @@ //! implementations. Expressions ([`crate::expr::Expression`]) reference scalar functions //! at each node. -use arcref::ArcRef; +use vortex_session::registry::Id; mod vtable; pub use vtable::*; @@ -34,7 +34,7 @@ pub mod fns; pub mod session; /// A unique identifier for a scalar function. -pub type ScalarFnId = ArcRef; +pub type ScalarFnId = Id; /// Private module to seal [`typed::DynScalarFn`]. mod sealed { diff --git a/vortex-array/src/serde.rs b/vortex-array/src/serde.rs index edbc31bdd0d..946a40518bc 100644 --- a/vortex-array/src/serde.rs +++ b/vortex-array/src/serde.rs @@ -762,8 +762,8 @@ mod tests { let ser = SerializedArray::from_array_tree(tree).unwrap(); let ctx = ReadContext::new([ - ArrayId::new_ref("vortex.test.foreign_array"), - ArrayId::new_ref("vortex.test.foreign_child"), + ArrayId::new("vortex.test.foreign_array"), + ArrayId::new("vortex.test.foreign_child"), ]); let session = VortexSession::empty() .with::() diff --git a/vortex-cuda/src/dynamic_dispatch/plan_builder.rs b/vortex-cuda/src/dynamic_dispatch/plan_builder.rs index ebeb94263b1..bec93d4336f 100644 --- a/vortex-cuda/src/dynamic_dispatch/plan_builder.rs +++ b/vortex-cuda/src/dynamic_dispatch/plan_builder.rs @@ -9,6 +9,7 @@ use itertools::zip_eq; use tracing::trace; use vortex::array::ArrayRef; +use vortex::array::ArrayVTable; use vortex::array::arrays::Dict; use vortex::array::arrays::Primitive; use vortex::array::arrays::Slice; @@ -66,14 +67,14 @@ fn is_dyn_dispatch_compatible(array: &ArrayRef) -> bool { } let id = array.encoding_id(); - if id == ALP::ID { + if id == ALP.id() { let arr = array.as_::(); return arr.patches().is_none() && arr.dtype().as_ptype() == PType::F32; } - if id == BitPacked::ID { + if id == BitPacked.id() { return array.as_::().patches().is_none(); } - if id == Dict::ID { + if id == Dict.id() { let arr = array.as_::(); // Nullable codes could hold garbage values at null positions, causing // out-of-bounds shared memory reads in the DICT gather scalar op. @@ -91,7 +92,7 @@ fn is_dyn_dispatch_compatible(array: &ArrayRef) -> bool { _ => false, }; } - if id == RunEnd::ID { + if id == RunEnd.id() { let arr = array.as_::(); // Nullable ends could hold garbage values at null positions, causing // unpredictable binary search / forward-scan behavior in the RUNEND @@ -110,11 +111,11 @@ fn is_dyn_dispatch_compatible(array: &ArrayRef) -> bool { _ => false, }; } - id == FoR::ID - || id == ZigZag::ID - || id == Primitive::ID - || id == Slice::ID - || id == Sequence::ID + id == FoR.id() + || id == ZigZag.id() + || id == Primitive.id() + || id == Slice.id() + || id == Sequence.id() } /// An unmaterialized stage: a source op, scalar ops, and optional source buffer reference. @@ -435,23 +436,23 @@ impl FusedPlan { let id = array.encoding_id(); - if id == BitPacked::ID { + if id == BitPacked.id() { self.walk_bitpacked(array) - } else if id == FoR::ID { + } else if id == FoR.id() { self.walk_for(array, pending_subtrees) - } else if id == ZigZag::ID { + } else if id == ZigZag.id() { self.walk_zigzag(array, pending_subtrees) - } else if id == ALP::ID { + } else if id == ALP.id() { self.walk_alp(array, pending_subtrees) - } else if id == Dict::ID { + } else if id == Dict.id() { self.walk_dict(array, pending_subtrees) - } else if id == RunEnd::ID { + } else if id == RunEnd.id() { self.walk_runend(array, pending_subtrees) - } else if id == Primitive::ID { + } else if id == Primitive.id() { self.walk_primitive(array) - } else if id == Slice::ID { + } else if id == Slice.id() { self.walk_slice(array, pending_subtrees) - } else if id == Sequence::ID { + } else if id == Sequence.id() { self.walk_sequence(array) } else { vortex_bail!( @@ -597,7 +598,7 @@ impl FusedPlan { pending_subtrees: &mut Vec, ) -> VortexResult { let ptype = PType::try_from(child.dtype())?; - if child.encoding_id() == Primitive::ID { + if child.encoding_id() == Primitive.id() { return self.walk_primitive(child); } let buf_idx = self.source_buffers.len(); diff --git a/vortex-cuda/src/executor.rs b/vortex-cuda/src/executor.rs index 2118d370d85..8234bfb8efe 100644 --- a/vortex-cuda/src/executor.rs +++ b/vortex-cuda/src/executor.rs @@ -16,6 +16,7 @@ use futures::future::BoxFuture; use tracing::debug; use tracing::trace; use vortex::array::ArrayRef; +use vortex::array::ArrayVTable; use vortex::array::Canonical; use vortex::array::ExecutionCtx; use vortex::array::IntoArray; @@ -352,7 +353,7 @@ pub trait CudaArrayExt { impl CudaArrayExt for ArrayRef { #[expect(clippy::unwrap_used)] async fn execute_cuda(self, ctx: &mut CudaExecutionCtx) -> VortexResult { - if self.encoding_id() == Struct::ID { + if self.encoding_id() == Struct.id() { let len = self.len(); let StructDataParts { fields, diff --git a/vortex-cuda/src/layout.rs b/vortex-cuda/src/layout.rs index 516968b8f82..ed69e235ad4 100644 --- a/vortex-cuda/src/layout.rs +++ b/vortex-cuda/src/layout.rs @@ -16,6 +16,7 @@ use futures::future::BoxFuture; use vortex::array::ArrayContext; use vortex::array::ArrayId; use vortex::array::ArrayRef; +use vortex::array::ArrayVTable; use vortex::array::DeserializeMetadata; use vortex::array::MaskFuture; use vortex::array::ProstMetadata; @@ -127,7 +128,7 @@ impl VTable for CudaFlat { type Metadata = ProstMetadata; fn id(_encoding: &Self::Encoding) -> LayoutId { - LayoutId::new_ref("vortex.cuda_flat") + LayoutId::new("vortex.cuda_flat") } fn encoding(_layout: &Self::Layout) -> LayoutEncodingRef { @@ -551,7 +552,7 @@ fn extract_constant_buffers(chunk: &ArrayRef) -> Vec { let mut buffer_idx = 0u32; for array in chunk.depth_first_traversal() { let n = array.nbuffers(); - if array.encoding_id() == Constant::ID { + if array.encoding_id() == Constant.id() { for buf in array.buffers() { result.push(InlinedBuffer { buffer_index: buffer_idx, diff --git a/vortex-cuda/src/lib.rs b/vortex-cuda/src/lib.rs index 274fe31b18f..d23cbac1403 100644 --- a/vortex-cuda/src/lib.rs +++ b/vortex-cuda/src/lib.rs @@ -59,6 +59,7 @@ pub use session::CudaSession; pub use session::CudaSessionExt; pub use stream::VortexCudaStream; pub use stream_pool::VortexCudaStreamPool; +use vortex::array::ArrayVTable; use vortex::array::arrays::Constant; use vortex::array::arrays::Dict; use vortex::array::arrays::Filter; @@ -93,22 +94,22 @@ pub fn cuda_available() -> bool { /// Registers CUDA kernels. pub fn initialize_cuda(session: &CudaSession) { info!("Registering CUDA kernels"); - session.register_kernel(ALP::ID, &ALPExecutor); - session.register_kernel(BitPacked::ID, &BitPackedExecutor); - session.register_kernel(Constant::ID, &ConstantNumericExecutor); - session.register_kernel(DateTimeParts::ID, &DateTimePartsExecutor); - session.register_kernel(DecimalByteParts::ID, &DecimalBytePartsExecutor); - session.register_kernel(Dict::ID, &DictExecutor); - session.register_kernel(Shared::ID, &SharedExecutor); - session.register_kernel(FoR::ID, &FoRExecutor); - session.register_kernel(RunEnd::ID, &RunEndExecutor); - session.register_kernel(Sequence::ID, &SequenceExecutor); - session.register_kernel(ZigZag::ID, &ZigZagExecutor); - session.register_kernel(Zstd::ID, &ZstdExecutor); + session.register_kernel(ALP.id(), &ALPExecutor); + session.register_kernel(BitPacked.id(), &BitPackedExecutor); + session.register_kernel(Constant.id(), &ConstantNumericExecutor); + session.register_kernel(DateTimeParts.id(), &DateTimePartsExecutor); + session.register_kernel(DecimalByteParts.id(), &DecimalBytePartsExecutor); + session.register_kernel(Dict.id(), &DictExecutor); + session.register_kernel(Shared.id(), &SharedExecutor); + session.register_kernel(FoR.id(), &FoRExecutor); + session.register_kernel(RunEnd.id(), &RunEndExecutor); + session.register_kernel(Sequence.id(), &SequenceExecutor); + session.register_kernel(ZigZag.id(), &ZigZagExecutor); + session.register_kernel(Zstd.id(), &ZstdExecutor); #[cfg(feature = "unstable_encodings")] - session.register_kernel(ZstdBuffers::ID, &ZstdBuffersExecutor); + session.register_kernel(ZstdBuffers.id(), &ZstdBuffersExecutor); // Operation kernels - session.register_kernel(Filter::ID, &FilterExecutor); - session.register_kernel(Slice::ID, &SliceExecutor); + session.register_kernel(Filter.id(), &FilterExecutor); + session.register_kernel(Slice.id(), &SliceExecutor); } diff --git a/vortex-cuda/src/session.rs b/vortex-cuda/src/session.rs index e6bf4710dda..cbb2ff79726 100644 --- a/vortex-cuda/src/session.rs +++ b/vortex-cuda/src/session.rs @@ -85,8 +85,12 @@ impl CudaSession { /// /// * `array_id` - The encoding ID to register support for /// * `executor` - A static reference to the CUDA support implementation - pub fn register_kernel(&self, array_id: ArrayId, executor: &'static dyn CudaExecute) { - self.kernels.insert(array_id, executor); + pub fn register_kernel( + &self, + array_id: impl Into, + executor: &'static dyn CudaExecute, + ) { + self.kernels.insert(array_id.into(), executor); } /// Retrieves the CUDA support implementation for an encoding, if registered. diff --git a/vortex-duckdb/src/convert/dtype.rs b/vortex-duckdb/src/convert/dtype.rs index ad66787f02e..401b31a90c6 100644 --- a/vortex-duckdb/src/convert/dtype.rs +++ b/vortex-duckdb/src/convert/dtype.rs @@ -583,7 +583,7 @@ mod tests { type NativeValue<'a> = &'a str; fn id(&self) -> ExtId { - ExtId::new_ref("unknown.extension") + ExtId::new("unknown.extension") } fn serialize_metadata(&self, _metadata: &Self::Metadata) -> VortexResult> { diff --git a/vortex-file/src/footer/mod.rs b/vortex-file/src/footer/mod.rs index e0d08568108..ac2153f7cd1 100644 --- a/vortex-file/src/footer/mod.rs +++ b/vortex-file/src/footer/mod.rs @@ -88,7 +88,7 @@ impl Footer { let layout_ids: Arc<[_]> = layout_specs .iter() .flat_map(|e| e.iter()) - .map(|encoding| LayoutEncodingId::new_arc(Arc::from(encoding.id()))) + .map(|encoding| LayoutEncodingId::new(encoding.id())) .collect(); let layout_read_ctx = ReadContext::new(layout_ids); @@ -97,7 +97,7 @@ impl Footer { let array_ids: Arc<[_]> = array_specs .iter() .flat_map(|e| e.iter()) - .map(|encoding| ArrayId::new_arc(Arc::from(encoding.id()))) + .map(|encoding| ArrayId::new(encoding.id())) .collect(); let array_read_ctx = ReadContext::new(array_ids); diff --git a/vortex-ipc/src/messages/decoder.rs b/vortex-ipc/src/messages/decoder.rs index d5f2cce336d..190461df96f 100644 --- a/vortex-ipc/src/messages/decoder.rs +++ b/vortex-ipc/src/messages/decoder.rs @@ -125,7 +125,7 @@ impl MessageDecoder { .encodings() .iter() .flat_map(|e| e.iter()) - .map(|id| ArrayId::new_arc(Arc::from(id.to_string()))) + .map(ArrayId::new) .collect(); let ctx = ReadContext::new(encoding_ids); diff --git a/vortex-layout/public-api.lock b/vortex-layout/public-api.lock index fd983e4e94c..4458a5a779c 100644 --- a/vortex-layout/public-api.lock +++ b/vortex-layout/public-api.lock @@ -2132,11 +2132,11 @@ pub type vortex_layout::ArrayFuture = futures_core::future::BoxFuture<'static, v pub type vortex_layout::LayoutContext = vortex_session::registry::Context -pub type vortex_layout::LayoutEncodingId = arcref::ArcRef +pub type vortex_layout::LayoutEncodingId = vortex_session::registry::Id pub type vortex_layout::LayoutEncodingRef = arcref::ArcRef -pub type vortex_layout::LayoutId = arcref::ArcRef +pub type vortex_layout::LayoutId = vortex_session::registry::Id pub type vortex_layout::LayoutReaderRef = alloc::sync::Arc diff --git a/vortex-layout/src/encoding.rs b/vortex-layout/src/encoding.rs index 271a94f9059..828634a8902 100644 --- a/vortex-layout/src/encoding.rs +++ b/vortex-layout/src/encoding.rs @@ -12,6 +12,7 @@ use vortex_array::dtype::DType; use vortex_error::VortexExpect; use vortex_error::VortexResult; use vortex_error::vortex_panic; +use vortex_session::registry::Id; use vortex_session::registry::ReadContext; use crate::IntoLayout; @@ -20,7 +21,8 @@ use crate::LayoutRef; use crate::VTable; use crate::segments::SegmentId; -pub type LayoutEncodingId = ArcRef; +/// A unique identifier for a layout encoding. +pub type LayoutEncodingId = Id; pub type LayoutEncodingRef = ArcRef; pub trait LayoutEncoding: 'static + Send + Sync + Debug + private::Sealed { diff --git a/vortex-layout/src/flatbuffers.rs b/vortex-layout/src/flatbuffers.rs index 02e05b199c8..4063e23eff7 100644 --- a/vortex-layout/src/flatbuffers.rs +++ b/vortex-layout/src/flatbuffers.rs @@ -259,8 +259,8 @@ mod tests { ); let layout_ctx = ReadContext::new([ - LayoutEncodingId::new_ref("vortex.test.foreign_layout"), - LayoutEncodingId::new_ref("vortex.test.foreign_child_layout"), + LayoutEncodingId::new("vortex.test.foreign_layout"), + LayoutEncodingId::new("vortex.test.foreign_child_layout"), ]); let array_ctx = ReadContext::new([]); let layouts = LayoutSession::default().registry().clone(); diff --git a/vortex-layout/src/layout.rs b/vortex-layout/src/layout.rs index 0d805623c0f..11f0afd629c 100644 --- a/vortex-layout/src/layout.rs +++ b/vortex-layout/src/layout.rs @@ -7,7 +7,6 @@ use std::fmt::Display; use std::fmt::Formatter; use std::sync::Arc; -use arcref::ArcRef; use itertools::Itertools; use vortex_array::SerializeMetadata; use vortex_array::dtype::DType; @@ -16,6 +15,7 @@ use vortex_error::VortexExpect; use vortex_error::VortexResult; use vortex_error::vortex_err; use vortex_session::VortexSession; +use vortex_session::registry::Id; use crate::LayoutEncodingId; use crate::LayoutEncodingRef; @@ -26,7 +26,8 @@ use crate::display::display_tree_with_segment_sizes; use crate::segments::SegmentId; use crate::segments::SegmentSource; -pub type LayoutId = ArcRef; +/// A unique identifier for a layout. +pub type LayoutId = Id; pub type LayoutRef = Arc; diff --git a/vortex-layout/src/layouts/chunked/mod.rs b/vortex-layout/src/layouts/chunked/mod.rs index af3c8bef4fa..82fcb650607 100644 --- a/vortex-layout/src/layouts/chunked/mod.rs +++ b/vortex-layout/src/layouts/chunked/mod.rs @@ -34,7 +34,7 @@ impl VTable for Chunked { type Metadata = EmptyMetadata; fn id(_encoding: &Self::Encoding) -> LayoutId { - LayoutId::new_ref("vortex.chunked") + LayoutId::new("vortex.chunked") } fn encoding(_layout: &Self::Layout) -> LayoutEncodingRef { diff --git a/vortex-layout/src/layouts/dict/mod.rs b/vortex-layout/src/layouts/dict/mod.rs index 866cf6587e9..7928b447fa9 100644 --- a/vortex-layout/src/layouts/dict/mod.rs +++ b/vortex-layout/src/layouts/dict/mod.rs @@ -40,7 +40,7 @@ impl VTable for Dict { type Metadata = ProstMetadata; fn id(_encoding: &Self::Encoding) -> LayoutId { - LayoutId::new_ref("vortex.dict") + LayoutId::new("vortex.dict") } fn encoding(_layout: &Self::Layout) -> LayoutEncodingRef { diff --git a/vortex-layout/src/layouts/dict/reader.rs b/vortex-layout/src/layouts/dict/reader.rs index 46d308fcdb8..1ffb669d08e 100644 --- a/vortex-layout/src/layouts/dict/reader.rs +++ b/vortex-layout/src/layouts/dict/reader.rs @@ -360,7 +360,7 @@ mod tests { )], Nullability::NonNullable, ); - assert!(layout.encoding_id() == LayoutId::new_ref("vortex.dict")); + assert!(layout.encoding_id() == LayoutId::new("vortex.dict")); let actual = layout .new_reader("".into(), segments, &session) .unwrap() @@ -504,7 +504,7 @@ mod tests { .unwrap(); let expression = is_not_null(root()); - assert_eq!(layout.encoding_id(), LayoutId::new_ref("vortex.dict")); + assert_eq!(layout.encoding_id(), LayoutId::new("vortex.dict")); let actual = layout .new_reader("".into(), segments, &session) .unwrap() diff --git a/vortex-layout/src/layouts/flat/mod.rs b/vortex-layout/src/layouts/flat/mod.rs index 6fa95a5e256..186ada897a7 100644 --- a/vortex-layout/src/layouts/flat/mod.rs +++ b/vortex-layout/src/layouts/flat/mod.rs @@ -43,7 +43,7 @@ impl VTable for Flat { type Metadata = ProstMetadata; fn id(_encoding: &Self::Encoding) -> LayoutId { - LayoutId::new_ref("vortex.flat") + LayoutId::new("vortex.flat") } fn encoding(_layout: &Self::Layout) -> LayoutEncodingRef { diff --git a/vortex-layout/src/layouts/foreign/mod.rs b/vortex-layout/src/layouts/foreign/mod.rs index 358e2a42be1..9abacc8b26e 100644 --- a/vortex-layout/src/layouts/foreign/mod.rs +++ b/vortex-layout/src/layouts/foreign/mod.rs @@ -40,7 +40,7 @@ impl LayoutEncoding for ForeignLayoutEncoding { } fn id(&self) -> LayoutEncodingId { - self.id.clone() + self.id } fn build( @@ -57,7 +57,7 @@ impl LayoutEncoding for ForeignLayoutEncoding { .collect::>>()?; Ok(new_foreign_layout( - self.id.clone(), + self.id, dtype.clone(), row_count, metadata.to_vec(), diff --git a/vortex-layout/src/layouts/row_idx/expr.rs b/vortex-layout/src/layouts/row_idx/expr.rs index c235193ac6c..2d85d6e43f5 100644 --- a/vortex-layout/src/layouts/row_idx/expr.rs +++ b/vortex-layout/src/layouts/row_idx/expr.rs @@ -25,7 +25,7 @@ impl ScalarFnVTable for RowIdx { type Options = EmptyOptions; fn id(&self) -> ScalarFnId { - ScalarFnId::from("vortex.row_idx") + ScalarFnId::new("vortex.row_idx") } fn arity(&self, _options: &Self::Options) -> Arity { diff --git a/vortex-layout/src/layouts/struct_/mod.rs b/vortex-layout/src/layouts/struct_/mod.rs index 3924394ff11..29843f096d8 100644 --- a/vortex-layout/src/layouts/struct_/mod.rs +++ b/vortex-layout/src/layouts/struct_/mod.rs @@ -42,7 +42,7 @@ impl VTable for Struct { type Metadata = EmptyMetadata; fn id(_encoding: &Self::Encoding) -> LayoutId { - LayoutId::new_ref("vortex.struct") + LayoutId::new("vortex.struct") } fn encoding(_layout: &Self::Layout) -> LayoutEncodingRef { diff --git a/vortex-layout/src/layouts/zoned/mod.rs b/vortex-layout/src/layouts/zoned/mod.rs index 5167025ff3a..3c524bedead 100644 --- a/vortex-layout/src/layouts/zoned/mod.rs +++ b/vortex-layout/src/layouts/zoned/mod.rs @@ -46,7 +46,7 @@ impl VTable for Zoned { type Metadata = ZonedMetadata; fn id(_encoding: &Self::Encoding) -> LayoutId { - LayoutId::new_ref("vortex.stats") // For legacy reasons, this is called stats + LayoutId::new("vortex.stats") // For legacy reasons, this is called stats } fn encoding(_layout: &Self::Layout) -> LayoutEncodingRef { diff --git a/vortex-python/src/arrays/py/array.rs b/vortex-python/src/arrays/py/array.rs index b73fc9c6fb0..e18972bdaf2 100644 --- a/vortex-python/src/arrays/py/array.rs +++ b/vortex-python/src/arrays/py/array.rs @@ -49,7 +49,7 @@ impl<'py> FromPyObject<'_, 'py> for PythonArray { let python_array = ob_cast.get(); Ok(Self { vtable: PythonVTable { - id: python_array.id.clone(), + id: python_array.id, }, object: Arc::new(ob.to_owned().unbind()), len: python_array.len, diff --git a/vortex-python/src/arrays/py/mod.rs b/vortex-python/src/arrays/py/mod.rs index 761d8a3d7df..c0aab2cb98c 100644 --- a/vortex-python/src/arrays/py/mod.rs +++ b/vortex-python/src/arrays/py/mod.rs @@ -9,7 +9,6 @@ pub(crate) use array::*; use pyo3::Bound; use pyo3::PyAny; use pyo3::exceptions::PyValueError; -use pyo3::intern; use pyo3::prelude::PyAnyMethods; pub(crate) use python::*; use vortex::array::ArrayId; @@ -19,15 +18,14 @@ use crate::error::PyVortexResult; /// Extract the array id from a Python class `id` attribute. pub fn id_from_obj(cls: &Bound) -> PyVortexResult { - Ok(ArrayId::new_arc( - cls.getattr(intern!(cls.py(), "id")) - .map_err(|_| { - PyValueError::new_err(format!( - "PyEncoding subclass {cls:?} must have an 'id' attribute" - )) - })? - .extract::() - .map_err(|_| PyValueError::new_err("'id' attribute must be a string"))? - .into(), - )) + let id_str: String = cls + .getattr("id") + .map_err(|_| { + PyValueError::new_err(format!( + "PyEncoding subclass {cls:?} must have an 'id' attribute" + )) + })? + .extract() + .map_err(|_| PyValueError::new_err("'id' attribute must be a string"))?; + Ok(ArrayId::new(&id_str)) } diff --git a/vortex-python/src/arrays/py/vtable.rs b/vortex-python/src/arrays/py/vtable.rs index aa646e971fe..4329c19261f 100644 --- a/vortex-python/src/arrays/py/vtable.rs +++ b/vortex-python/src/arrays/py/vtable.rs @@ -54,7 +54,7 @@ impl VTable for PythonVTable { type ValidityVTable = Self; fn id(&self) -> ArrayId { - self.id.clone() + self.id } fn validate( diff --git a/vortex-python/src/serde/context.rs b/vortex-python/src/serde/context.rs index 6a4f6d5d3a2..9e88a523749 100644 --- a/vortex-python/src/serde/context.rs +++ b/vortex-python/src/serde/context.rs @@ -74,9 +74,7 @@ impl PyReadContext { #[new] fn new(ids: Vec) -> Self { Self(ReadContext::new( - ids.into_iter() - .map(|i| Id::new_arc(Arc::from(i))) - .collect::>(), + ids.into_iter().map(|i| Id::new(&i)).collect::>(), )) } diff --git a/vortex-session/Cargo.toml b/vortex-session/Cargo.toml index f6af94e1260..263c8c8500c 100644 --- a/vortex-session/Cargo.toml +++ b/vortex-session/Cargo.toml @@ -22,6 +22,7 @@ workspace = true [dependencies] arcref = { workspace = true } dashmap = { workspace = true } +lasso = { workspace = true } parking_lot = { workspace = true } vortex-error = { workspace = true } vortex-utils = { workspace = true, features = ["dashmap"] } diff --git a/vortex-session/public-api.lock b/vortex-session/public-api.lock index 55413e768ef..a63e955f77a 100644 --- a/vortex-session/public-api.lock +++ b/vortex-session/public-api.lock @@ -2,6 +2,18 @@ pub mod vortex_session pub mod vortex_session::registry +pub struct vortex_session::registry::CachedId + +impl vortex_session::registry::CachedId + +pub const fn vortex_session::registry::CachedId::new(s: &'static str) -> Self + +impl core::ops::deref::Deref for vortex_session::registry::CachedId + +pub type vortex_session::registry::CachedId::Target = vortex_session::registry::Id + +pub fn vortex_session::registry::CachedId::deref(&self) -> &vortex_session::registry::Id + pub struct vortex_session::registry::Context impl vortex_session::registry::Context @@ -28,6 +40,66 @@ impl core::default::Default for vortex_session::registry::Context pub fn vortex_session::registry::Context::default() -> Self +pub struct vortex_session::registry::Id(_) + +impl vortex_session::registry::Id + +pub fn vortex_session::registry::Id::as_str(&self) -> &str + +pub fn vortex_session::registry::Id::new(s: &str) -> Self + +pub fn vortex_session::registry::Id::new_static(s: &'static str) -> Self + +impl core::clone::Clone for vortex_session::registry::Id + +pub fn vortex_session::registry::Id::clone(&self) -> vortex_session::registry::Id + +impl core::cmp::Eq for vortex_session::registry::Id + +impl core::cmp::Ord for vortex_session::registry::Id + +pub fn vortex_session::registry::Id::cmp(&self, other: &Self) -> core::cmp::Ordering + +impl core::cmp::PartialEq for vortex_session::registry::Id + +pub fn vortex_session::registry::Id::eq(&self, other: &vortex_session::registry::Id) -> bool + +impl core::cmp::PartialEq<&vortex_session::registry::Id> for vortex_session::registry::Id + +pub fn vortex_session::registry::Id::eq(&self, other: &&vortex_session::registry::Id) -> bool + +impl core::cmp::PartialEq for &vortex_session::registry::Id + +pub fn &vortex_session::registry::Id::eq(&self, other: &vortex_session::registry::Id) -> bool + +impl core::cmp::PartialOrd for vortex_session::registry::Id + +pub fn vortex_session::registry::Id::partial_cmp(&self, other: &Self) -> core::option::Option + +impl core::convert::AsRef for vortex_session::registry::Id + +pub fn vortex_session::registry::Id::as_ref(&self) -> &str + +impl core::convert::From<&str> for vortex_session::registry::Id + +pub fn vortex_session::registry::Id::from(s: &str) -> Self + +impl core::fmt::Debug for vortex_session::registry::Id + +pub fn vortex_session::registry::Id::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result + +impl core::fmt::Display for vortex_session::registry::Id + +pub fn vortex_session::registry::Id::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result + +impl core::hash::Hash for vortex_session::registry::Id + +pub fn vortex_session::registry::Id::hash<__H: core::hash::Hasher>(&self, state: &mut __H) + +impl core::marker::Copy for vortex_session::registry::Id + +impl core::marker::StructuralPartialEq for vortex_session::registry::Id + pub struct vortex_session::registry::ReadContext impl vortex_session::registry::ReadContext @@ -76,8 +148,6 @@ impl core::default::Default for vortex_session::registry::Registry pub fn vortex_session::registry::Registry::default() -> Self -pub type vortex_session::registry::Id = arcref::ArcRef - pub struct vortex_session::Ref<'a, T>(_) impl<'a, T> vortex_session::Ref<'a, T> diff --git a/vortex-session/src/registry.rs b/vortex-session/src/registry.rs index 35a65b086a3..a739b9fdda3 100644 --- a/vortex-session/src/registry.rs +++ b/vortex-session/src/registry.rs @@ -4,17 +4,139 @@ //! Many session types use a registry of objects that can be looked up by name to construct //! contexts. This module provides a generic registry type for that purpose. +use std::cmp::Ordering; +use std::fmt; use std::fmt::Debug; +use std::fmt::Display; +use std::fmt::Formatter; use std::ops::Deref; use std::sync::Arc; +use std::sync::LazyLock; +use std::sync::OnceLock; -use arcref::ArcRef; +use lasso::Spur; +use lasso::ThreadedRodeo; use parking_lot::RwLock; use vortex_error::VortexExpect; use vortex_utils::aliases::dash_map::DashMap; -/// An identifier for an item in a registry. -pub type Id = ArcRef; +/// Global string interner for [`Id`] values. +static INTERNER: LazyLock = LazyLock::new(ThreadedRodeo::new); + +/// A lightweight, copyable identifier backed by a global string interner. +/// +/// Used for array encoding IDs, scalar function IDs, layout IDs, and similar +/// globally-unique string identifiers throughout Vortex. Equality and hashing +/// are O(1) symbol comparisons. +#[derive(Clone, Copy, PartialEq, Eq, Hash)] +pub struct Id(Spur); + +impl Id { + /// Intern a string and return its `Id`. + pub fn new(s: &str) -> Self { + Self(INTERNER.get_or_intern(s)) + } + + /// Intern a string and return its `Id`. + pub fn new_static(s: &'static str) -> Self { + Self(INTERNER.get_or_intern_static(s)) + } + + /// Returns the interned string. + pub fn as_str(&self) -> &str { + let s = INTERNER.resolve(&self.0); + // SAFETY: INTERNER is 'static and its arena is append-only, so resolved string + // pointers are stable for the lifetime of the program. + unsafe { &*(s as *const str) } + } +} + +impl From<&str> for Id { + fn from(s: &str) -> Self { + Self::new(s) + } +} + +impl Display for Id { + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str(self.as_str()) + } +} + +impl Debug for Id { + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + write!(f, "Id(\"{}\")", self.as_str()) + } +} + +impl PartialOrd for Id { + fn partial_cmp(&self, other: &Self) -> Option { + Some(self.cmp(other)) + } +} + +impl Ord for Id { + fn cmp(&self, other: &Self) -> Ordering { + self.as_str().cmp(other.as_str()) + } +} + +impl AsRef for Id { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl PartialEq<&Id> for Id { + fn eq(&self, other: &&Id) -> bool { + self == *other + } +} + +impl PartialEq for &Id { + fn eq(&self, other: &Id) -> bool { + *self == other + } +} + +/// A lazily-initialized, cached [`Id`] for use as a `static`. +/// +/// Avoids repeated interner write-lock acquisition by storing the interned [`Id`] +/// on first access and returning the cached copy on all subsequent calls. +/// +/// # Example +/// +/// ``` +/// use vortex_session::registry::{CachedId, Id}; +/// +/// static MY_ID: CachedId = CachedId::new("my.encoding"); +/// +/// fn get_id() -> Id { +/// *MY_ID +/// } +/// ``` +pub struct CachedId { + s: &'static str, + cached: OnceLock, +} + +impl CachedId { + /// Create a new `CachedId` that will intern `s` on first access. + pub const fn new(s: &'static str) -> Self { + Self { + s, + cached: OnceLock::new(), + } + } +} + +impl Deref for CachedId { + type Target = Id; + + fn deref(&self) -> &Id { + self.cached.get_or_init(|| Id::new(self.s)) + } +} /// A registry of items that are keyed by a string identifier. #[derive(Clone, Debug)] @@ -33,7 +155,7 @@ impl Registry { /// List the IDs in the registry. pub fn ids(&self) -> impl Iterator + '_ { - self.0.iter().map(|i| i.key().clone()) + self.0.iter().map(|i| *i.key()) } /// List the items in the registry. @@ -156,7 +278,7 @@ impl Context { idx < u16::MAX as usize, "Cannot have more than u16::MAX items" ); - ids.push(id.clone()); + ids.push(*id); Some(u16::try_from(idx).vortex_expect("checked already")) } diff --git a/vortex-tensor/src/fixed_shape/vtable.rs b/vortex-tensor/src/fixed_shape/vtable.rs index 21ab1ef5336..52e32ef0cf6 100644 --- a/vortex-tensor/src/fixed_shape/vtable.rs +++ b/vortex-tensor/src/fixed_shape/vtable.rs @@ -22,7 +22,7 @@ impl ExtVTable for FixedShapeTensor { type NativeValue<'a> = &'a ScalarValue; fn id(&self) -> ExtId { - ExtId::new_ref("vortex.tensor.fixed_shape_tensor") + ExtId::new("vortex.fixed_shape_tensor") } fn serialize_metadata(&self, metadata: &Self::Metadata) -> VortexResult> { diff --git a/vortex-tensor/src/scalar_fns/l2_denorm.rs b/vortex-tensor/src/scalar_fns/l2_denorm.rs index c0f0f54fb12..181322855cf 100644 --- a/vortex-tensor/src/scalar_fns/l2_denorm.rs +++ b/vortex-tensor/src/scalar_fns/l2_denorm.rs @@ -139,7 +139,7 @@ impl ScalarFnVTable for L2Denorm { type Options = EmptyOptions; fn id(&self) -> ScalarFnId { - ScalarFnId::new_ref("vortex.tensor.l2_denorm") + ScalarFnId::new("vortex.tensor.l2_denorm") } fn arity(&self, _options: &Self::Options) -> Arity { diff --git a/vortex-tensor/src/scalar_fns/sorf_transform/vtable.rs b/vortex-tensor/src/scalar_fns/sorf_transform/vtable.rs index 69ae671bc85..5c77b48eb87 100644 --- a/vortex-tensor/src/scalar_fns/sorf_transform/vtable.rs +++ b/vortex-tensor/src/scalar_fns/sorf_transform/vtable.rs @@ -48,7 +48,7 @@ impl ScalarFnVTable for SorfTransform { type Options = SorfOptions; fn id(&self) -> ScalarFnId { - ScalarFnId::new_ref("vortex.tensor.sorf_transform") + ScalarFnId::new("vortex.tensor.sorf_transform") } fn arity(&self, _options: &Self::Options) -> Arity { diff --git a/vortex-tensor/src/vector/vtable.rs b/vortex-tensor/src/vector/vtable.rs index 2dda05b7363..19fe57fed41 100644 --- a/vortex-tensor/src/vector/vtable.rs +++ b/vortex-tensor/src/vector/vtable.rs @@ -20,7 +20,7 @@ impl ExtVTable for Vector { type NativeValue<'a> = &'a ScalarValue; fn id(&self) -> ExtId { - ExtId::new_ref("vortex.tensor.vector") + ExtId::new("vortex.tensor.vector") } fn serialize_metadata(&self, _metadata: &Self::Metadata) -> VortexResult> { diff --git a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/bool.rs b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/bool.rs index e710438a2ce..97a05f8458b 100644 --- a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/bool.rs +++ b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/bool.rs @@ -3,6 +3,7 @@ use vortex_array::ArrayId; use vortex_array::ArrayRef; +use vortex_array::ArrayVTable; use vortex_array::IntoArray; use vortex_array::arrays::Bool; use vortex_array::arrays::BoolArray; @@ -25,7 +26,7 @@ impl FlatLayoutFixture for BooleansFixture { } fn expected_encodings(&self) -> Vec { - vec![Bool::ID] + vec![Bool.id()] } fn build(&self) -> VortexResult { diff --git a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/chunked.rs b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/chunked.rs index 683d5b809a3..8f5782fb36e 100644 --- a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/chunked.rs +++ b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/chunked.rs @@ -3,6 +3,7 @@ use vortex_array::ArrayId; use vortex_array::ArrayRef; +use vortex_array::ArrayVTable; use vortex_array::IntoArray; use vortex_array::arrays::ChunkedArray; use vortex_array::arrays::Primitive; @@ -26,7 +27,7 @@ impl FlatLayoutFixture for ChunkedFixture { } fn expected_encodings(&self) -> Vec { - vec![Primitive::ID] + vec![Primitive.id()] } fn build(&self) -> VortexResult { diff --git a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/datetime.rs b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/datetime.rs index 9571136ca38..792901d2bec 100644 --- a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/datetime.rs +++ b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/datetime.rs @@ -5,6 +5,7 @@ use std::sync::Arc; use vortex_array::ArrayId; use vortex_array::ArrayRef; +use vortex_array::ArrayVTable; use vortex_array::IntoArray; use vortex_array::arrays::Extension; use vortex_array::arrays::PrimitiveArray; @@ -30,7 +31,7 @@ impl FlatLayoutFixture for DateTimeFixture { } fn expected_encodings(&self) -> Vec { - vec![Extension::ID] + vec![Extension.id()] } fn build(&self) -> VortexResult { diff --git a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/decimal.rs b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/decimal.rs index d7e261cdbf4..98f857f5988 100644 --- a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/decimal.rs +++ b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/decimal.rs @@ -3,6 +3,7 @@ use vortex_array::ArrayId; use vortex_array::ArrayRef; +use vortex_array::ArrayVTable; use vortex_array::IntoArray; use vortex_array::arrays::Decimal; use vortex_array::arrays::DecimalArray; @@ -27,7 +28,7 @@ impl FlatLayoutFixture for DecimalFixture { } fn expected_encodings(&self) -> Vec { - vec![Decimal::ID] + vec![Decimal.id()] } fn build(&self) -> VortexResult { diff --git a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/fixed_size_list.rs b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/fixed_size_list.rs index c1c2e615b76..4b10ea607cf 100644 --- a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/fixed_size_list.rs +++ b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/fixed_size_list.rs @@ -3,6 +3,7 @@ use vortex_array::ArrayId; use vortex_array::ArrayRef; +use vortex_array::ArrayVTable; use vortex_array::IntoArray; use vortex_array::arrays::FixedSizeList; use vortex_array::arrays::FixedSizeListArray; @@ -27,7 +28,7 @@ impl FlatLayoutFixture for FixedSizeListFixture { } fn expected_encodings(&self) -> Vec { - vec![FixedSizeList::ID] + vec![FixedSizeList.id()] } fn build(&self) -> VortexResult { diff --git a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/list.rs b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/list.rs index dd09e002630..ab844ab01b7 100644 --- a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/list.rs +++ b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/list.rs @@ -3,6 +3,7 @@ use vortex_array::ArrayId; use vortex_array::ArrayRef; +use vortex_array::ArrayVTable; use vortex_array::IntoArray; use vortex_array::arrays::List; use vortex_array::arrays::ListArray; @@ -28,7 +29,7 @@ impl FlatLayoutFixture for ListFixture { } fn expected_encodings(&self) -> Vec { - vec![List::ID] + vec![List.id()] } fn build(&self) -> VortexResult { diff --git a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/listview.rs b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/listview.rs index 0a9ab2191ef..d81aaadfa5d 100644 --- a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/listview.rs +++ b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/listview.rs @@ -3,6 +3,7 @@ use vortex_array::ArrayId; use vortex_array::ArrayRef; +use vortex_array::ArrayVTable; use vortex_array::IntoArray; use vortex_array::arrays::ListView; use vortex_array::arrays::ListViewArray; @@ -28,7 +29,7 @@ impl FlatLayoutFixture for ListViewFixture { } fn expected_encodings(&self) -> Vec { - vec![ListView::ID] + vec![ListView.id()] } fn build(&self) -> VortexResult { diff --git a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/null.rs b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/null.rs index 0d937a1c225..1c7dfa25f84 100644 --- a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/null.rs +++ b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/null.rs @@ -3,6 +3,7 @@ use vortex_array::ArrayId; use vortex_array::ArrayRef; +use vortex_array::ArrayVTable; use vortex_array::IntoArray; use vortex_array::arrays::Null; use vortex_array::arrays::NullArray; @@ -27,7 +28,7 @@ impl FlatLayoutFixture for NullFixture { } fn expected_encodings(&self) -> Vec { - vec![Null::ID] + vec![Null.id()] } fn build(&self) -> VortexResult { diff --git a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/primitive.rs b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/primitive.rs index f77d5f42f39..a84c59f3fb5 100644 --- a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/primitive.rs +++ b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/primitive.rs @@ -3,6 +3,7 @@ use vortex_array::ArrayId; use vortex_array::ArrayRef; +use vortex_array::ArrayVTable; use vortex_array::IntoArray; use vortex_array::arrays::Primitive; use vortex_array::arrays::PrimitiveArray; @@ -26,7 +27,7 @@ impl FlatLayoutFixture for PrimitivesFixture { } fn expected_encodings(&self) -> Vec { - vec![Primitive::ID] + vec![Primitive.id()] } fn build(&self) -> VortexResult { diff --git a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/struct_nested.rs b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/struct_nested.rs index cc02d856aab..d5d3eb4bd08 100644 --- a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/struct_nested.rs +++ b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/struct_nested.rs @@ -3,6 +3,7 @@ use vortex_array::ArrayId; use vortex_array::ArrayRef; +use vortex_array::ArrayVTable; use vortex_array::IntoArray; use vortex_array::arrays::PrimitiveArray; use vortex_array::arrays::Struct; @@ -27,7 +28,7 @@ impl FlatLayoutFixture for StructNestedFixture { } fn expected_encodings(&self) -> Vec { - vec![Struct::ID] + vec![Struct.id()] } fn build(&self) -> VortexResult { diff --git a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/varbin.rs b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/varbin.rs index 72ac683ee44..26bbd3d554e 100644 --- a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/varbin.rs +++ b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/varbin.rs @@ -3,6 +3,7 @@ use vortex_array::ArrayId; use vortex_array::ArrayRef; +use vortex_array::ArrayVTable; use vortex_array::IntoArray; use vortex_array::arrays::StructArray; use vortex_array::arrays::VarBin; @@ -25,7 +26,7 @@ impl FlatLayoutFixture for VarBinFixture { } fn expected_encodings(&self) -> Vec { - vec![VarBin::ID] + vec![VarBin.id()] } fn build(&self) -> VortexResult { diff --git a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/varbinview.rs b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/varbinview.rs index f795dafce49..ae32129a082 100644 --- a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/varbinview.rs +++ b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/arrays/varbinview.rs @@ -3,6 +3,7 @@ use vortex_array::ArrayId; use vortex_array::ArrayRef; +use vortex_array::ArrayVTable; use vortex_array::IntoArray; use vortex_array::arrays::StructArray; use vortex_array::arrays::VarBinView; @@ -25,7 +26,7 @@ impl FlatLayoutFixture for VarBinViewFixture { } fn expected_encodings(&self) -> Vec { - vec![VarBinView::ID] + vec![VarBinView.id()] } fn build(&self) -> VortexResult { diff --git a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/alp.rs b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/alp.rs index 9de554a8ee7..6cf60cf4270 100644 --- a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/alp.rs +++ b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/alp.rs @@ -3,6 +3,7 @@ use vortex::array::ArrayId; use vortex::array::ArrayRef; +use vortex::array::ArrayVTable; use vortex::array::IntoArray; use vortex::array::arrays::PrimitiveArray; use vortex::array::arrays::StructArray; @@ -55,7 +56,7 @@ impl FlatLayoutFixture for AlpFixture { } fn expected_encodings(&self) -> Vec { - vec![ALP::ID] + vec![ALP.id()] } fn build(&self) -> VortexResult { diff --git a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/alprd.rs b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/alprd.rs index 977fc7cab36..04b5115e94d 100644 --- a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/alprd.rs +++ b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/alprd.rs @@ -3,6 +3,7 @@ use vortex::array::ArrayId; use vortex::array::ArrayRef; +use vortex::array::ArrayVTable; use vortex::array::IntoArray; use vortex::array::arrays::PrimitiveArray; use vortex::array::arrays::StructArray; @@ -41,7 +42,7 @@ impl FlatLayoutFixture for AlprdFixture { } fn expected_encodings(&self) -> Vec { - vec![ALPRD::ID] + vec![ALPRD.id()] } fn build(&self) -> VortexResult { diff --git a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/bitpacked.rs b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/bitpacked.rs index c0dc53817b3..9f3b67291d9 100644 --- a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/bitpacked.rs +++ b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/bitpacked.rs @@ -3,6 +3,7 @@ use vortex::array::ArrayId; use vortex::array::ArrayRef; +use vortex::array::ArrayVTable; use vortex::array::IntoArray; use vortex::array::arrays::PrimitiveArray; use vortex::array::arrays::StructArray; @@ -27,7 +28,7 @@ impl FlatLayoutFixture for BitPackedFixture { } fn expected_encodings(&self) -> Vec { - vec![BitPacked::ID] + vec![BitPacked.id()] } fn build(&self) -> VortexResult { diff --git a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/bytebool.rs b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/bytebool.rs index 53cf79463d6..a410d2354c0 100644 --- a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/bytebool.rs +++ b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/bytebool.rs @@ -3,6 +3,7 @@ use vortex::array::ArrayId; use vortex::array::ArrayRef; +use vortex::array::ArrayVTable; use vortex::array::IntoArray; use vortex::array::arrays::BoolArray; use vortex::array::arrays::StructArray; @@ -27,7 +28,7 @@ impl FlatLayoutFixture for ByteBoolFixture { } fn expected_encodings(&self) -> Vec { - vec![ByteBool::ID] + vec![ByteBool.id()] } fn build(&self) -> VortexResult { diff --git a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/constant.rs b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/constant.rs index 64feb357093..38e97d9f448 100644 --- a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/constant.rs +++ b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/constant.rs @@ -3,6 +3,7 @@ use vortex::array::ArrayId; use vortex::array::ArrayRef; +use vortex::array::ArrayVTable; use vortex::array::IntoArray; use vortex::array::arrays::Constant; use vortex::array::arrays::ConstantArray; @@ -34,7 +35,7 @@ impl FlatLayoutFixture for ConstantFixture { } fn expected_encodings(&self) -> Vec { - vec![Constant::ID] + vec![Constant.id()] } fn build(&self) -> VortexResult { diff --git a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/datetimeparts.rs b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/datetimeparts.rs index bfbf2cba21c..c77b6c6a731 100644 --- a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/datetimeparts.rs +++ b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/datetimeparts.rs @@ -3,6 +3,7 @@ use vortex::array::ArrayId; use vortex::array::ArrayRef; +use vortex::array::ArrayVTable; use vortex::array::IntoArray; use vortex::array::arrays::PrimitiveArray; use vortex::array::arrays::StructArray; @@ -35,7 +36,7 @@ impl FlatLayoutFixture for DateTimePartsFixture { } fn expected_encodings(&self) -> Vec { - vec![DateTimeParts::ID] + vec![DateTimeParts.id()] } fn build(&self) -> VortexResult { diff --git a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/decimal_byte_parts.rs b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/decimal_byte_parts.rs index 723df6c5378..79f6659c065 100644 --- a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/decimal_byte_parts.rs +++ b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/decimal_byte_parts.rs @@ -3,6 +3,7 @@ use vortex::array::ArrayId; use vortex::array::ArrayRef; +use vortex::array::ArrayVTable; use vortex::array::IntoArray; use vortex::array::arrays::PrimitiveArray; use vortex::array::arrays::StructArray; @@ -27,7 +28,7 @@ impl FlatLayoutFixture for DecimalBytePartsFixture { } fn expected_encodings(&self) -> Vec { - vec![DecimalByteParts::ID] + vec![DecimalByteParts.id()] } fn build(&self) -> VortexResult { diff --git a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/delta.rs b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/delta.rs index f69e54c4631..21519d2a3b1 100644 --- a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/delta.rs +++ b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/delta.rs @@ -4,6 +4,7 @@ use vortex::VortexSessionDefault; use vortex::array::ArrayId; use vortex::array::ArrayRef; +use vortex::array::ArrayVTable; use vortex::array::IntoArray; use vortex::array::VortexSessionExecute; use vortex::array::arrays::PrimitiveArray; @@ -30,7 +31,7 @@ impl FlatLayoutFixture for DeltaFixture { } fn expected_encodings(&self) -> Vec { - vec![Delta::ID] + vec![Delta.id()] } fn build(&self) -> VortexResult { diff --git a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/dict.rs b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/dict.rs index 84107b08b2a..add08b5f8e3 100644 --- a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/dict.rs +++ b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/dict.rs @@ -3,6 +3,7 @@ use vortex::array::ArrayId; use vortex::array::ArrayRef; +use vortex::array::ArrayVTable; use vortex::array::IntoArray; use vortex::array::arrays::Dict; use vortex::array::arrays::PrimitiveArray; @@ -28,7 +29,7 @@ impl FlatLayoutFixture for DictFixture { } fn expected_encodings(&self) -> Vec { - vec![Dict::ID] + vec![Dict.id()] } fn build(&self) -> VortexResult { diff --git a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/for_.rs b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/for_.rs index 3c1a96b6bb1..70fe9d8d8ec 100644 --- a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/for_.rs +++ b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/for_.rs @@ -3,6 +3,7 @@ use vortex::array::ArrayId; use vortex::array::ArrayRef; +use vortex::array::ArrayVTable; use vortex::array::IntoArray; use vortex::array::arrays::PrimitiveArray; use vortex::array::arrays::StructArray; @@ -26,7 +27,7 @@ impl FlatLayoutFixture for FoRFixture { } fn expected_encodings(&self) -> Vec { - vec![FoR::ID] + vec![FoR.id()] } fn build(&self) -> VortexResult { diff --git a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/fsst.rs b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/fsst.rs index 91d0f8dce07..4365fb1a01c 100644 --- a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/fsst.rs +++ b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/fsst.rs @@ -3,6 +3,7 @@ use vortex::array::ArrayId; use vortex::array::ArrayRef; +use vortex::array::ArrayVTable; use vortex::array::IntoArray; use vortex::array::arrays::StructArray; use vortex::array::arrays::VarBinArray; @@ -28,7 +29,7 @@ impl FlatLayoutFixture for FsstFixture { } fn expected_encodings(&self) -> Vec { - vec![FSST::ID] + vec![FSST.id()] } fn build(&self) -> VortexResult { diff --git a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/pco.rs b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/pco.rs index a80be0c5c13..f6902fdc2c5 100644 --- a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/pco.rs +++ b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/pco.rs @@ -3,6 +3,7 @@ use vortex::array::ArrayId; use vortex::array::ArrayRef; +use vortex::array::ArrayVTable; use vortex::array::IntoArray; use vortex::array::arrays::PrimitiveArray; use vortex::array::arrays::StructArray; @@ -26,7 +27,7 @@ impl FlatLayoutFixture for PcoFixture { } fn expected_encodings(&self) -> Vec { - vec![Pco::ID] + vec![Pco.id()] } fn build(&self) -> VortexResult { diff --git a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/rle.rs b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/rle.rs index ac0d4ba85e7..bebcb9fa12b 100644 --- a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/rle.rs +++ b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/rle.rs @@ -3,6 +3,7 @@ use vortex::array::ArrayId; use vortex::array::ArrayRef; +use vortex::array::ArrayVTable; use vortex::array::IntoArray; use vortex::array::arrays::PrimitiveArray; use vortex::array::arrays::StructArray; @@ -26,7 +27,7 @@ impl FlatLayoutFixture for RleFixture { } fn expected_encodings(&self) -> Vec { - vec![RLE::ID] + vec![RLE.id()] } fn build(&self) -> VortexResult { diff --git a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/runend.rs b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/runend.rs index e5594edcc7f..da81a2b07c4 100644 --- a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/runend.rs +++ b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/runend.rs @@ -3,6 +3,7 @@ use vortex::array::ArrayId; use vortex::array::ArrayRef; +use vortex::array::ArrayVTable; use vortex::array::IntoArray; use vortex::array::arrays::BoolArray; use vortex::array::arrays::PrimitiveArray; @@ -29,7 +30,7 @@ impl FlatLayoutFixture for RunEndFixture { } fn expected_encodings(&self) -> Vec { - vec![RunEnd::ID] + vec![RunEnd.id()] } fn build(&self) -> VortexResult { diff --git a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/sequence.rs b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/sequence.rs index 61bd87252fb..9d9493f99c1 100644 --- a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/sequence.rs +++ b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/sequence.rs @@ -3,6 +3,7 @@ use vortex::array::ArrayId; use vortex::array::ArrayRef; +use vortex::array::ArrayVTable; use vortex::array::IntoArray; use vortex::array::arrays::StructArray; use vortex::array::dtype::FieldNames; @@ -26,7 +27,7 @@ impl FlatLayoutFixture for SequenceFixture { } fn expected_encodings(&self) -> Vec { - vec![Sequence::ID] + vec![Sequence.id()] } fn build(&self) -> VortexResult { diff --git a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/sparse.rs b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/sparse.rs index eeff8c36c1b..724b41abf30 100644 --- a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/sparse.rs +++ b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/sparse.rs @@ -3,6 +3,7 @@ use vortex::array::ArrayId; use vortex::array::ArrayRef; +use vortex::array::ArrayVTable; use vortex::array::IntoArray; use vortex::array::arrays::BoolArray; use vortex::array::arrays::ConstantArray; @@ -31,7 +32,7 @@ impl FlatLayoutFixture for SparseFixture { } fn expected_encodings(&self) -> Vec { - vec![Sparse::ID] + vec![Sparse.id()] } fn build(&self) -> VortexResult { diff --git a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/zigzag.rs b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/zigzag.rs index ec852bf8deb..16e553854a0 100644 --- a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/zigzag.rs +++ b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/zigzag.rs @@ -3,6 +3,7 @@ use vortex::array::ArrayId; use vortex::array::ArrayRef; +use vortex::array::ArrayVTable; use vortex::array::IntoArray; use vortex::array::arrays::PrimitiveArray; use vortex::array::arrays::StructArray; @@ -27,7 +28,7 @@ impl FlatLayoutFixture for ZigZagFixture { } fn expected_encodings(&self) -> Vec { - vec![ZigZag::ID] + vec![ZigZag.id()] } fn build(&self) -> VortexResult { diff --git a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/zstd.rs b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/zstd.rs index 655cbba8c06..16736672878 100644 --- a/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/zstd.rs +++ b/vortex-test/compat-gen/src/fixtures/arrays/synthetic/encodings/zstd.rs @@ -3,6 +3,7 @@ use vortex::array::ArrayId; use vortex::array::ArrayRef; +use vortex::array::ArrayVTable; use vortex::array::IntoArray; use vortex::array::arrays::PrimitiveArray; use vortex::array::arrays::StructArray; @@ -27,7 +28,7 @@ impl FlatLayoutFixture for ZstdFixture { } fn expected_encodings(&self) -> Vec { - vec![Zstd::ID] + vec![Zstd.id()] } fn build(&self) -> VortexResult {