diff --git a/vortex-array/src/arrays/extension/vtable/mod.rs b/vortex-array/src/arrays/extension/vtable/mod.rs index 0e4dfbabfc5..07ee76c04b1 100644 --- a/vortex-array/src/arrays/extension/vtable/mod.rs +++ b/vortex-array/src/arrays/extension/vtable/mod.rs @@ -4,6 +4,7 @@ mod array; mod canonical; mod operations; +mod operator; mod serde; mod validity; mod visitor; diff --git a/vortex-array/src/arrays/extension/vtable/operator.rs b/vortex-array/src/arrays/extension/vtable/operator.rs new file mode 100644 index 00000000000..8f755fbf39a --- /dev/null +++ b/vortex-array/src/arrays/extension/vtable/operator.rs @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Copyright the Vortex contributors + +use vortex_error::VortexResult; + +use crate::ArrayRef; +use crate::arrays::{ExtensionArray, ExtensionVTable}; +use crate::execution::{BatchKernelRef, BindCtx}; +use crate::vtable::OperatorVTable; + +impl OperatorVTable for ExtensionVTable { + fn bind( + array: &ExtensionArray, + selection: Option<&ArrayRef>, + ctx: &mut dyn BindCtx, + ) -> VortexResult { + // Since vectors are physically typed, extension array can delegate to its storage array + ctx.bind(&array.storage, selection) + } +} diff --git a/vortex-array/src/arrays/null/mod.rs b/vortex-array/src/arrays/null/mod.rs index 79e6e95dd80..0e08d97b6c3 100644 --- a/vortex-array/src/arrays/null/mod.rs +++ b/vortex-array/src/arrays/null/mod.rs @@ -9,12 +9,14 @@ use vortex_dtype::DType; use vortex_error::VortexResult; use vortex_mask::Mask; use vortex_scalar::Scalar; +use vortex_vector::NullVector; +use crate::execution::{BatchKernelRef, BindCtx, kernel}; use crate::serde::ArrayChildren; use crate::stats::{ArrayStats, StatsSetRef}; use crate::vtable::{ - ArrayVTable, CanonicalVTable, NotSupported, OperationsVTable, SerdeVTable, VTable, - ValidityVTable, VisitorVTable, + ArrayVTable, CanonicalVTable, NotSupported, OperationsVTable, OperatorVTable, SerdeVTable, + VTable, ValidityVTable, VisitorVTable, }; use crate::{ ArrayBufferVisitor, ArrayChildVisitor, ArrayRef, Canonical, EmptyMetadata, EncodingId, @@ -36,8 +38,8 @@ impl VTable for NullVTable { type VisitorVTable = Self; type ComputeVTable = NotSupported; type EncodeVTable = NotSupported; - type OperatorVTable = NotSupported; type SerdeVTable = Self; + type OperatorVTable = Self; fn id(_encoding: &Self::Encoding) -> EncodingId { EncodingId::new_ref("vortex.null") @@ -170,3 +172,14 @@ impl ValidityVTable for NullVTable { Mask::AllFalse(array.len) } } + +impl OperatorVTable for NullVTable { + fn bind( + array: &NullArray, + _selection: Option<&ArrayRef>, + _ctx: &mut dyn BindCtx, + ) -> VortexResult { + let len = array.len(); + Ok(kernel(move || Ok(NullVector::new(len).into()))) + } +}