vortex_array/arrow/
mod.rs1use arrow_array::ArrayRef as ArrowArrayRef;
7use arrow_schema::DataType;
8use vortex_error::VortexResult;
9
10mod array;
11pub mod compute;
12mod convert;
13mod datum;
14mod iter;
15mod record_batch;
16
17pub use datum::*;
18pub use iter::*;
19
20use crate::arrow::compute::ToArrowOptions;
21
22pub trait FromArrowArray<A> {
23 fn from_arrow(array: A, nullable: bool) -> Self;
24}
25
26pub trait IntoArrowArray {
27 fn into_arrow_preferred(self) -> VortexResult<ArrowArrayRef>;
28
29 fn into_arrow(self, data_type: &DataType) -> VortexResult<ArrowArrayRef>;
30}
31
32impl IntoArrowArray for crate::ArrayRef {
33 fn into_arrow_preferred(self) -> VortexResult<ArrowArrayRef> {
36 compute::to_arrow_opts(&self, &ToArrowOptions { arrow_type: None })
37 }
38
39 fn into_arrow(self, data_type: &DataType) -> VortexResult<ArrowArrayRef> {
40 compute::to_arrow_opts(
41 &self,
42 &ToArrowOptions {
43 arrow_type: Some(data_type.clone()),
44 },
45 )
46 }
47}