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