Skip to main content

Module build

Module build 

Source
Expand description

Column constructors shared by every AstrsMessage implementation.

The std layouts of §24.3 are built from four shapes — a primitive column, a List of a primitive, a FixedSizeList of a primitive, and a Struct composing those — so four constructors cover all of them. Writing the implementations against these rather than against the array types directly keeps every one of them short enough to read against the normative layout it is supposed to produce.

Everything here builds non-nullable columns. The std types are total: a Pose has a position, and a null one would be a different type (Option<Pose> is expressed as an absent message, not a null row). Nothing in this module can therefore produce a validity bitmap, which is also why astrs_data::RecordBatch::from_payload marks the field non-nullable for every payload built here.

§Examples

use astrs_data::{DataType, Field};
use astrs_node_api::message::build;

let column = build::primitive::<f64>(&[1.0, 2.0, 3.0]);
assert_eq!(column.len(), 3);

let lists = build::primitive_lists::<f32>("range", &[&[1.0, 2.0][..], &[3.0][..]])?;
assert_eq!(lists.len(), 2);
assert_eq!(
    lists.data_type(),
    &DataType::list(Field::required("range", DataType::Float32))
);

Functions§

binaries
A non-nullable Binary column.
boolean
A non-nullable boolean column.
fixed_tuple_lists
A List<FixedSizeList<item_name: T, width>> column.
fixed_tuples
A FixedSizeList<item_name: T, width> column, one tuple per row.
nested_lists
A List<item_name: item_type> column over already-built per-row children.
primitive
A non-nullable primitive column.
primitive_lists
A List<item_name: T> column, one list per entry of rows.
strings
A non-nullable Utf8 column.
structure
A non-nullable Struct column from named child columns.
timestamps
A non-nullable Timestamp(ns) column.