Function pretty_format_batches_with_schema
pub fn pretty_format_batches_with_schema(
schema: Arc<Schema>,
results: &[RecordBatch],
) -> Result<impl Display, ArrowError>
Expand description
Create a visual representation of RecordBatch
es with a provided schema.
Useful to display empty batches.
ยงExample
let schema = Arc::new(Schema::new(vec![
Field::new("a", DataType::Int32, false),
Field::new("b", DataType::Utf8, true),
]));
// Note, returned object implements `Display`
let pretty_table = pretty_format_batches_with_schema(schema, &[]).unwrap();
let table_str = format!("Batches:\n{pretty_table}");
assert_eq!(table_str,
r#"Batches:
+---+---+
| a | b |
+---+---+
+---+---+"#);