pub trait IntoArrow {
type A: Array;
// Required method
fn into_arrow(self) -> Self::A;
}Expand description
Data that can be converted to an Arrow array.
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 NullArray, which is useful for
outputs that carry only metadata.
For the opposite direction (reading received Arrow data back into Rust
types), see the TryFrom<&ArrowData> implementations on ArrowData.
§Example
use arrow::array::Array;
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 Associated Types§
Required Methods§
Sourcefn into_arrow(self) -> Self::A
fn into_arrow(self) -> Self::A
Convert the data into an Arrow array.
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 &str
impl IntoArrow for &str
type A = GenericByteArray<GenericStringType<i32>>
fn into_arrow(self) -> <&str as IntoArrow>::A
Source§impl IntoArrow for NaiveDate
impl IntoArrow for NaiveDate
type A = PrimitiveArray<Date64Type>
fn into_arrow(self) -> <NaiveDate as IntoArrow>::A
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).