pub struct SchemaDescriptor {
schema: TypePtr,
leaves: Vec<ColumnDescPtr>,
leaf_to_base: Vec<usize>,
}Expand description
Schema of a Parquet file.
Encapsulates the file’s schema (Type) and ColumnDescriptors for
each primitive (leaf) column.
§Example
use parquet::schema::types::{SchemaDescriptor, Type};
use parquet::basic; // note there are two `Type`s that are different
// Schema for a table with two columns: "a" (int64) and "b" (int32, stored as a date)
let descriptor = SchemaDescriptor::new(
Arc::new(
Type::group_type_builder("my_schema")
.with_fields(vec![
Arc::new(
Type::primitive_type_builder("a", basic::Type::INT64)
.build().unwrap()
),
Arc::new(
Type::primitive_type_builder("b", basic::Type::INT32)
.with_converted_type(basic::ConvertedType::DATE)
.with_logical_type(Some(basic::LogicalType::Date))
.build().unwrap()
),
])
.build().unwrap()
)
);Fields§
§schema: TypePtrThe top-level logical schema (the “message” type).
This must be a Type::GroupType where each field is a root
column type in the schema.
leaves: Vec<ColumnDescPtr>The descriptors for the physical type of each leaf column in this schema
Constructed from schema in DFS order.
leaf_to_base: Vec<usize>Mapping from a leaf column’s index to the root column index that it comes from.
For instance: the leaf a.b.c.d would have a link back to a:
-- a <-----+
-- -- b |
-- -- -- c |
-- -- -- -- dImplementations§
Source§impl SchemaDescriptor
impl SchemaDescriptor
Sourcepub fn column(&self, i: usize) -> ColumnDescPtr
pub fn column(&self, i: usize) -> ColumnDescPtr
Returns ColumnDescriptor for a field position.
Sourcepub fn columns(&self) -> &[ColumnDescPtr] ⓘ
pub fn columns(&self) -> &[ColumnDescPtr] ⓘ
Returns slice of ColumnDescriptor.
Sourcepub fn num_columns(&self) -> usize
pub fn num_columns(&self) -> usize
Returns number of leaf-level columns.
Sourcepub fn get_column_root(&self, i: usize) -> &Type
pub fn get_column_root(&self, i: usize) -> &Type
Returns column root Type for a leaf position.
Sourcepub fn get_column_root_ptr(&self, i: usize) -> TypePtr
pub fn get_column_root_ptr(&self, i: usize) -> TypePtr
Returns column root Type pointer for a leaf position.
Sourcepub fn get_column_root_idx(&self, leaf: usize) -> usize
pub fn get_column_root_idx(&self, leaf: usize) -> usize
Returns the index of the root column for a field position
fn column_root_of(&self, i: usize) -> &TypePtr
Sourcepub fn root_schema(&self) -> &Type
pub fn root_schema(&self) -> &Type
Returns schema as Type.
Sourcepub fn root_schema_ptr(&self) -> TypePtr
pub fn root_schema_ptr(&self) -> TypePtr
Returns schema as TypePtr for cheap cloning.
Trait Implementations§
Source§impl Clone for SchemaDescriptor
impl Clone for SchemaDescriptor
Source§fn clone(&self) -> SchemaDescriptor
fn clone(&self) -> SchemaDescriptor
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more