Trait deltalake::datafusion::parquet::schema::visitor::TypeVisitor

source ·
pub trait TypeVisitor<R, C> {
    // Required methods
    fn visit_primitive(
        &mut self,
        primitive_type: Arc<Type>,
        context: C
    ) -> Result<R, ParquetError>;
    fn visit_struct(
        &mut self,
        struct_type: Arc<Type>,
        context: C
    ) -> Result<R, ParquetError>;
    fn visit_map(
        &mut self,
        map_type: Arc<Type>,
        context: C
    ) -> Result<R, ParquetError>;
    fn visit_list_with_item(
        &mut self,
        list_type: Arc<Type>,
        item_type: Arc<Type>,
        context: C
    ) -> Result<R, ParquetError>;

    // Provided methods
    fn visit_list(
        &mut self,
        list_type: Arc<Type>,
        context: C
    ) -> Result<R, ParquetError> { ... }
    fn dispatch(
        &mut self,
        cur_type: Arc<Type>,
        context: C
    ) -> Result<R, ParquetError> { ... }
}
Expand description

A utility trait to help user to traverse against parquet type.

Required Methods§

source

fn visit_primitive( &mut self, primitive_type: Arc<Type>, context: C ) -> Result<R, ParquetError>

Called when a primitive type hit.

source

fn visit_struct( &mut self, struct_type: Arc<Type>, context: C ) -> Result<R, ParquetError>

Called when a struct type hit.

source

fn visit_map( &mut self, map_type: Arc<Type>, context: C ) -> Result<R, ParquetError>

Called when a map type hit.

source

fn visit_list_with_item( &mut self, list_type: Arc<Type>, item_type: Arc<Type>, context: C ) -> Result<R, ParquetError>

Called by visit_list.

Provided Methods§

source

fn visit_list( &mut self, list_type: Arc<Type>, context: C ) -> Result<R, ParquetError>

Default implementation when visiting a list.

It checks list type definition and calls Self::visit_list_with_item with extracted item type.

To fully understand this algorithm, please refer to parquet doc.

For example, a standard list type looks like:

required/optional group my_list (LIST) {

In such a case, Self::visit_list_with_item will be called with my_list as the list type, and element as the item_type

source

fn dispatch( &mut self, cur_type: Arc<Type>, context: C ) -> Result<R, ParquetError>

A utility method which detects input type and calls corresponding method.

Implementors§