Trait parquet::schema::visitor::TypeVisitor
source · 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§
sourcefn visit_primitive(&mut self, primitive_type: TypePtr, context: C) -> Result<R>
fn visit_primitive(&mut self, primitive_type: TypePtr, context: C) -> Result<R>
Called when a primitive type hit.
sourcefn visit_struct(&mut self, struct_type: TypePtr, context: C) -> Result<R>
fn visit_struct(&mut self, struct_type: TypePtr, context: C) -> Result<R>
Called when a struct type hit.
sourcefn visit_map(&mut self, map_type: TypePtr, context: C) -> Result<R>
fn visit_map(&mut self, map_type: TypePtr, context: C) -> Result<R>
Called when a map type hit.
sourcefn visit_list_with_item(
&mut self,
list_type: TypePtr,
item_type: TypePtr,
context: C,
) -> Result<R>
fn visit_list_with_item( &mut self, list_type: TypePtr, item_type: TypePtr, context: C, ) -> Result<R>
Called by visit_list
.
Provided Methods§
sourcefn visit_list(&mut self, list_type: TypePtr, context: C) -> Result<R>
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