Skip to main content

record_batch

Macro record_batch 

macro_rules! record_batch {
    ($(($name: expr, $type: ident, $($values: tt)+)),*) => { ... };
}
Expand description

Creates a record batch from literal slice of values, suitable for rapid testing and development.

Example:

use arrow_array::record_batch;
use arrow_schema;

let batch = record_batch!(
    ("a", Int32, [1, 2, 3]),
    ("b", Float64, [Some(4.0), None, Some(5.0)]),
    ("c", Utf8, ["alpha", "beta", "gamma"])
);

Variables and expressions are also supported:

use arrow_array::record_batch;

let values = vec![1, 2, 3];
let batch = record_batch!(
    ("a", Int32, values),
    ("b", Float64, vec![Some(4.0), None, Some(5.0)])
);

Due to limitation of create_array! macro, support for limited data types is available.