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

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

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

Required Methods§

source

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

Called when a primitive type hit.

source

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

Called when a struct type hit.

source

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

Called when a map type hit.

source

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

Called by visit_list.

Provided Methods§

source

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

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: TypePtr, context: C) -> Result<R>

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

Implementors§