pub trait IntoArrow {
// Required method
fn into_arrow(self) -> DoraArray;
}Expand description
Data that can be converted into a dora payload.
This is the conversion that dora node APIs use to turn plain Rust values
into the Apache Arrow columnar format before
sending them as outputs. Implementations are provided for booleans,
strings, the primitive integer and float types, Vecs of those primitive
types, and a few chrono date/time types. The unit type () converts to
an empty null array, which is useful for outputs that carry only metadata.
DoraArray itself implements the trait as the identity conversion, so
send_output accepts both plain Rust values and already-built payloads.
The trait deliberately has no associated type: an
type A: arrow::array::Array bound would put Arrow back into dora’s frozen
public API and pin 1.x to a single Arrow major. into_arrow returns the
dora-owned DoraArray instead.
For the opposite direction (reading received Arrow data back into Rust
types), see the TryFrom<&DoraArray> implementations on DoraArray.
§Example
use dora_arrow_convert::IntoArrow;
let array = vec![1.0_f32, 2.0, 3.0].into_arrow();
assert_eq!(array.len(), 3);
let single = 42_u8.into_arrow();
assert_eq!(single.len(), 1);Required Methods§
Sourcefn into_arrow(self) -> DoraArray
fn into_arrow(self) -> DoraArray
Convert the data into a dora payload.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl IntoArrow for NaiveDateTime
The nanosecond-resolution i64 timestamp can only represent dates in roughly
1677-09-21..2262-04-11. Dates outside that range are saturated to i64::MIN
(far-past) or i64::MAX (far-future) and a tracing::warn! is emitted,
rather than silently mapping to the Unix epoch (the previous behaviour).
impl IntoArrow for NaiveDateTime
The nanosecond-resolution i64 timestamp can only represent dates in roughly
1677-09-21..2262-04-11. Dates outside that range are saturated to i64::MIN
(far-past) or i64::MAX (far-future) and a tracing::warn! is emitted,
rather than silently mapping to the Unix epoch (the previous behaviour).