Skip to main content

ArrayParentReduceRule

Trait ArrayParentReduceRule 

Source
pub trait ArrayParentReduceRule<V: VTable>:
    Debug
    + Send
    + Sync
    + 'static {
    type Parent: Matcher;

    // Required method
    fn reduce_parent(
        &self,
        array: ArrayView<'_, V>,
        parent: <Self::Parent as Matcher>::Match<'_>,
        child_idx: usize,
    ) -> VortexResult<Option<ArrayRef>>;
}
Expand description

A metadata-only rewrite rule where a child encoding rewrites its parent (Layer 2).

The child sees the parent’s type via the associated Parent Matcher and can return a replacement for the parent. This enables optimizations like pushing operations through compression layers (e.g., pushing a scalar function into dictionary values).

Required Associated Types§

Source

type Parent: Matcher

The parent array type this rule matches against.

Required Methods§

Source

fn reduce_parent( &self, array: ArrayView<'_, V>, parent: <Self::Parent as Matcher>::Match<'_>, child_idx: usize, ) -> VortexResult<Option<ArrayRef>>

Attempt to rewrite this child array given information about its parent.

Returns:

  • Ok(Some(new_array)) if the rule applied successfully
  • Ok(None) if the rule doesn’t apply
  • Err(e) if an error occurred

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§