pub trait ReferenceBuilder {
    // Required methods
    fn field(
        &mut self,
        name: &str
    ) -> Result<&mut dyn ReferenceBuilder, SubstraitExprError>;
    fn list_item(
        &mut self,
        idx: u32
    ) -> Result<&mut dyn ReferenceBuilder, SubstraitExprError>;
    fn map_item(
        &mut self,
        key: Expression
    ) -> Result<&mut dyn ReferenceBuilder, SubstraitExprError>;
    fn build(&mut self) -> Result<Expression, SubstraitExprError>;
}
Expand description

A builder for expressions (field references) based on schemas

TODO: Add examples

Required Methods§

source

fn field( &mut self, name: &str ) -> Result<&mut dyn ReferenceBuilder, SubstraitExprError>

References a field within the schema

Can also be called again to reference a nested field with the chosen field

source

fn list_item( &mut self, idx: u32 ) -> Result<&mut dyn ReferenceBuilder, SubstraitExprError>

Assuming the current node is a list column this will reference the idx’th item in the list. If the list doesn’t have enough items then NULL is returned (TODO: does substrait mandate this?)

source

fn map_item( &mut self, key: Expression ) -> Result<&mut dyn ReferenceBuilder, SubstraitExprError>

Assuming the current node is a map column this will reference an item in the map with the given key. If the map doesn’t have an item matching this key then NULL is returned.

key must be a literal

source

fn build(&mut self) -> Result<Expression, SubstraitExprError>

Consume the builder to create a reference

Implementors§