Skip to main content

VTable

Trait VTable 

Source
pub trait VTable:
    'static
    + Clone
    + Send
    + Sync
    + Debug {
    type LayoutData: 'static + Clone + Send + Sync + Debug;
    type Metadata: SerializeMetadata + DeserializeMetadata + Debug;

    // Required methods
    fn id(&self) -> LayoutId;
    fn metadata(layout: &Layout<Self>) -> Self::Metadata;
    fn deserialize(
        &self,
        args: &LayoutDeserializeArgs<'_>,
        metadata: &<Self::Metadata as DeserializeMetadata>::Output,
    ) -> VortexResult<Self::LayoutData>;
    fn child_dtype(layout: &Layout<Self>, slot: usize) -> VortexResult<DType>;
    fn child_type(layout: &Layout<Self>, slot: usize) -> LayoutChildType;
    fn new_reader(
        layout: &Layout<Self>,
        name: Arc<str>,
        segment_source: Arc<dyn SegmentSource>,
        session: &VortexSession,
        ctx: &LayoutReaderContext,
    ) -> VortexResult<LayoutReaderRef>;

    // Provided methods
    fn build(
        vtable: &Self,
        dtype: &DType,
        row_count: u64,
        metadata: &<Self::Metadata as DeserializeMetadata>::Output,
        segment_ids: Vec<SegmentId>,
        children: &dyn LayoutChildren,
        build_ctx: &LayoutBuildContext<'_>,
    ) -> VortexResult<Layout<Self>> { ... }
    fn nslots(layout: &Layout<Self>) -> usize { ... }
    fn slot_to_child(layout: &Layout<Self>, slot: usize) -> Option<usize> { ... }
    fn is_indivisible(&self) -> bool { ... }
}
Expand description

Layout-specific behavior for a typed Layout.

Common serialized fields are stored by Layout. Implementations own only their layout-specific data, metadata codec, child typing, and reader construction.

Required Associated Types§

Source

type LayoutData: 'static + Clone + Send + Sync + Debug

Layout-specific data.

Source

type Metadata: SerializeMetadata + DeserializeMetadata + Debug

Serialized metadata type.

Required Methods§

Source

fn id(&self) -> LayoutId

Returns the globally unique layout ID.

Source

fn metadata(layout: &Layout<Self>) -> Self::Metadata

Returns the serializable metadata for a layout.

Source

fn deserialize( &self, args: &LayoutDeserializeArgs<'_>, metadata: &<Self::Metadata as DeserializeMetadata>::Output, ) -> VortexResult<Self::LayoutData>

Deserialize and validate layout-specific data.

Source

fn child_dtype(layout: &Layout<Self>, slot: usize) -> VortexResult<DType>

Returns the expected dtype of the child in logical slot.

Source

fn child_type(layout: &Layout<Self>, slot: usize) -> LayoutChildType

Returns the relationship between the child in logical slot and its parent.

Source

fn new_reader( layout: &Layout<Self>, name: Arc<str>, segment_source: Arc<dyn SegmentSource>, session: &VortexSession, ctx: &LayoutReaderContext, ) -> VortexResult<LayoutReaderRef>

Construct a reader for this layout.

Provided Methods§

Source

fn build( vtable: &Self, dtype: &DType, row_count: u64, metadata: &<Self::Metadata as DeserializeMetadata>::Output, segment_ids: Vec<SegmentId>, children: &dyn LayoutChildren, build_ctx: &LayoutBuildContext<'_>, ) -> VortexResult<Layout<Self>>

Construct a typed layout from deserialized common fields.

Source

fn nslots(layout: &Layout<Self>) -> usize

Returns the number of logical child slots of this layout.

Slots are fixed logical positions: a given child always occupies the same slot index regardless of which optional siblings are present. A slot may be absent (see slot_to_child), in which case it has no corresponding serialized child. The default implementation reports one slot per serialized child, i.e. every slot is always present.

Source

fn slot_to_child(layout: &Layout<Self>, slot: usize) -> Option<usize>

Maps a logical slot to the index of its serialized (dense) child, or None if the slot is absent for this layout instance.

Serialized children are stored densely (present-only), so an absent slot shifts the dense indices of the slots that follow it. This mapping centralizes that arithmetic; the default implementation is the identity, treating slot indices and dense child indices as equal.

Source

fn is_indivisible(&self) -> bool

Returns true if this layout is indivisible: its readers never register natural split boundaries strictly inside their row range (see crate::LayoutReader::register_splits).

Indivisible layouts — like flat, whose readers only ever push the end of the requested range — let parent layouts skip materializing the child entirely during split collection.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§