pub trait VTable:
'static
+ Clone
+ Sized
+ Send
+ Sync
+ Debug {
type Array: 'static + Send + Sync + Clone + Debug + Deref<Target = dyn DynArray> + IntoArray;
type Metadata: Debug;
type OperationsVTable: OperationsVTable<Self>;
type ValidityVTable: ValidityVTable<Self>;
Show 23 methods
// Required methods
fn vtable(array: &Self::Array) -> &Self;
fn id(&self) -> ArrayId;
fn len(array: &Self::Array) -> usize;
fn dtype(array: &Self::Array) -> &DType;
fn stats(array: &Self::Array) -> StatsSetRef<'_>;
fn array_hash<H: Hasher>(
array: &Self::Array,
state: &mut H,
precision: Precision,
);
fn array_eq(
array: &Self::Array,
other: &Self::Array,
precision: Precision,
) -> bool;
fn nbuffers(array: &Self::Array) -> usize;
fn buffer(array: &Self::Array, idx: usize) -> BufferHandle;
fn buffer_name(array: &Self::Array, idx: usize) -> Option<String>;
fn nchildren(array: &Self::Array) -> usize;
fn child(array: &Self::Array, idx: usize) -> ArrayRef;
fn child_name(array: &Self::Array, idx: usize) -> String;
fn metadata(array: &Self::Array) -> VortexResult<Self::Metadata>;
fn serialize(metadata: Self::Metadata) -> VortexResult<Option<Vec<u8>>>;
fn deserialize(
bytes: &[u8],
_dtype: &DType,
_len: usize,
_buffers: &[BufferHandle],
_session: &VortexSession,
) -> VortexResult<Self::Metadata>;
fn build(
dtype: &DType,
len: usize,
metadata: &Self::Metadata,
buffers: &[BufferHandle],
children: &dyn ArrayChildren,
) -> VortexResult<Self::Array>;
fn with_children(
array: &mut Self::Array,
children: Vec<ArrayRef>,
) -> VortexResult<()>;
fn execute(
array: Arc<Array<Self>>,
ctx: &mut ExecutionCtx,
) -> VortexResult<ExecutionResult>;
// Provided methods
fn append_to_builder(
array: &Self::Array,
builder: &mut dyn ArrayBuilder,
ctx: &mut ExecutionCtx,
) -> VortexResult<()> { ... }
fn execute_parent(
array: &Array<Self>,
parent: &ArrayRef,
child_idx: usize,
ctx: &mut ExecutionCtx,
) -> VortexResult<Option<ArrayRef>> { ... }
fn reduce(array: &Array<Self>) -> VortexResult<Option<ArrayRef>> { ... }
fn reduce_parent(
array: &Array<Self>,
parent: &ArrayRef,
child_idx: usize,
) -> VortexResult<Option<ArrayRef>> { ... }
}Expand description
The array VTable encapsulates logic for an Array type within Vortex.
The logic is split across several “VTable” traits to enable easier code organization than simply lumping everything into a single trait.
From this VTable trait, we derive implementations for the sealed DynArray and DynVTable
traits.
The functions defined in these vtable traits will typically document their pre- and
post-conditions. The pre-conditions are validated inside the DynArray and DynVTable
implementations so do not need to be checked in the vtable implementations (for example, index
out of bounds). Post-conditions are validated after invocation of the vtable function and will
panic if violated.
Required Associated Types§
type Array: 'static + Send + Sync + Clone + Debug + Deref<Target = dyn DynArray> + IntoArray
type Metadata: Debug
type OperationsVTable: OperationsVTable<Self>
type ValidityVTable: ValidityVTable<Self>
Required Methods§
Sourcefn stats(array: &Self::Array) -> StatsSetRef<'_>
fn stats(array: &Self::Array) -> StatsSetRef<'_>
Returns the stats set for the array.
Sourcefn array_hash<H: Hasher>(
array: &Self::Array,
state: &mut H,
precision: Precision,
)
fn array_hash<H: Hasher>( array: &Self::Array, state: &mut H, precision: Precision, )
Hashes the array contents.
Sourcefn array_eq(
array: &Self::Array,
other: &Self::Array,
precision: Precision,
) -> bool
fn array_eq( array: &Self::Array, other: &Self::Array, precision: Precision, ) -> bool
Compares two arrays of the same type for equality.
Sourcefn buffer(array: &Self::Array, idx: usize) -> BufferHandle
fn buffer(array: &Self::Array, idx: usize) -> BufferHandle
Sourcefn buffer_name(array: &Self::Array, idx: usize) -> Option<String>
fn buffer_name(array: &Self::Array, idx: usize) -> Option<String>
Returns the name of the buffer at the given index, or None if unnamed.
Sourcefn child_name(array: &Self::Array, idx: usize) -> String
fn child_name(array: &Self::Array, idx: usize) -> String
Sourcefn metadata(array: &Self::Array) -> VortexResult<Self::Metadata>
fn metadata(array: &Self::Array) -> VortexResult<Self::Metadata>
Exports metadata for an array.
Sourcefn serialize(metadata: Self::Metadata) -> VortexResult<Option<Vec<u8>>>
fn serialize(metadata: Self::Metadata) -> VortexResult<Option<Vec<u8>>>
Serialize metadata into a byte buffer for IPC or file storage.
Return None if the array cannot be serialized.
Sourcefn deserialize(
bytes: &[u8],
_dtype: &DType,
_len: usize,
_buffers: &[BufferHandle],
_session: &VortexSession,
) -> VortexResult<Self::Metadata>
fn deserialize( bytes: &[u8], _dtype: &DType, _len: usize, _buffers: &[BufferHandle], _session: &VortexSession, ) -> VortexResult<Self::Metadata>
Deserialize array metadata from a byte buffer.
Sourcefn build(
dtype: &DType,
len: usize,
metadata: &Self::Metadata,
buffers: &[BufferHandle],
children: &dyn ArrayChildren,
) -> VortexResult<Self::Array>
fn build( dtype: &DType, len: usize, metadata: &Self::Metadata, buffers: &[BufferHandle], children: &dyn ArrayChildren, ) -> VortexResult<Self::Array>
Build an array from components.
Sourcefn with_children(
array: &mut Self::Array,
children: Vec<ArrayRef>,
) -> VortexResult<()>
fn with_children( array: &mut Self::Array, children: Vec<ArrayRef>, ) -> VortexResult<()>
Replaces the children in array with children.
Sourcefn execute(
array: Arc<Array<Self>>,
ctx: &mut ExecutionCtx,
) -> VortexResult<ExecutionResult>
fn execute( array: Arc<Array<Self>>, ctx: &mut ExecutionCtx, ) -> VortexResult<ExecutionResult>
Execute this array by returning an ExecutionResult.
Provided Methods§
Sourcefn append_to_builder(
array: &Self::Array,
builder: &mut dyn ArrayBuilder,
ctx: &mut ExecutionCtx,
) -> VortexResult<()>
fn append_to_builder( array: &Self::Array, builder: &mut dyn ArrayBuilder, ctx: &mut ExecutionCtx, ) -> VortexResult<()>
Writes the array into a canonical builder.
Sourcefn execute_parent(
array: &Array<Self>,
parent: &ArrayRef,
child_idx: usize,
ctx: &mut ExecutionCtx,
) -> VortexResult<Option<ArrayRef>>
fn execute_parent( array: &Array<Self>, parent: &ArrayRef, child_idx: usize, ctx: &mut ExecutionCtx, ) -> VortexResult<Option<ArrayRef>>
Attempt to execute the parent of this array.
Sourcefn reduce(array: &Array<Self>) -> VortexResult<Option<ArrayRef>>
fn reduce(array: &Array<Self>) -> VortexResult<Option<ArrayRef>>
Attempt to reduce the array to a simpler representation.
Sourcefn reduce_parent(
array: &Array<Self>,
parent: &ArrayRef,
child_idx: usize,
) -> VortexResult<Option<ArrayRef>>
fn reduce_parent( array: &Array<Self>, parent: &ArrayRef, child_idx: usize, ) -> VortexResult<Option<ArrayRef>>
Attempt to perform a reduction of the parent of this array.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.