pub fn tree(arrow: &Schema) -> SchemaTreeExpand description
An Arrow schema drawn as a tree: each field with its Arrow type,
(required) when it is not nullable, and its metadata; nested fields
under their parents.
use arrow_schema::{DataType, Field, Schema, TimeUnit};
use rich::Console;
let schema = Schema::new(vec![
Field::new("id", DataType::Int64, false),
Field::new("at", DataType::Timestamp(TimeUnit::Millisecond, Some("UTC".into())), true),
Field::new("tags", DataType::new_list(DataType::Utf8, true), true),
]);
let console = Console::builder().width(60).color_system(None).build();
assert_eq!(
console.render_to_string(&rich_data::arrow::tree(&schema)),
"schema 3 fields\n\
├── id (required) Int64\n\
├── at Timestamp(ms, \"UTC\")\n\
└── tags List\n \
└── item Utf8"
);