pub fn print_schema(out: &mut dyn Write, tp: &Type)
Expand description
Prints Parquet Type
information.
ยงExample
use parquet::{
basic::{ConvertedType, Repetition, Type as PhysicalType},
schema::{printer::print_schema, types::Type},
};
use std::sync::Arc;
let field_a = Type::primitive_type_builder("a", PhysicalType::BYTE_ARRAY)
.with_id(Some(42))
.with_converted_type(ConvertedType::UTF8)
.build()
.unwrap();
let field_b = Type::primitive_type_builder("b", PhysicalType::INT32)
.with_repetition(Repetition::REQUIRED)
.build()
.unwrap();
let field_d = Type::primitive_type_builder("d", PhysicalType::INT64)
.with_id(Some(99))
.build()
.unwrap();
let field_c = Type::group_type_builder("c")
.with_id(Some(43))
.with_fields(vec![Arc::new(field_d)])
.build()
.unwrap();
let schema = Type::group_type_builder("schema")
.with_fields(vec![Arc::new(field_a), Arc::new(field_b), Arc::new(field_c)])
.build()
.unwrap();
print_schema(&mut std::io::stdout(), &schema);
outputs
message schema {
OPTIONAL BYTE_ARRAY a [42] (UTF8);
REQUIRED INT32 b;
message c [43] {
OPTIONAL INT64 d [99];
}
}