vortex_arrow/lib.rs
1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright the Vortex contributors
3
4//! Apache Arrow interoperability for Vortex.
5//!
6//! This crate owns every conversion between Vortex and Arrow. The authoritative entry point is
7//! the [`ArrowSession`]: importing Arrow schemas, fields, and data types into Vortex
8//! ([`ArrowSession::from_arrow_schema`], [`ArrowSession::from_arrow_field`],
9//! [`ArrowSession::from_arrow_datatype`]), importing Arrow arrays and record batches
10//! ([`ArrowSession::from_arrow_array`], [`ArrowSession::from_arrow_record_batch`]),
11//! exporting Vortex dtypes to Arrow
12//! ([`ArrowSession::to_arrow_schema`], [`ArrowSession::to_arrow_field`],
13//! [`ArrowSession::to_arrow_datatype`]), and executing Vortex arrays into Arrow
14//! ([`ArrowSession::execute_arrow`] and the [`ArrowArrayExecutor`] convenience trait).
15//!
16//! The [`ArrowSession`] session variable is created lazily on first use of
17//! [`ArrowSessionExt::arrow`], so no explicit registration is required for plain conversions.
18
19use vortex_session::VortexSession;
20
21pub mod convert;
22mod datum;
23pub mod dtype;
24mod executor;
25mod iter;
26mod null_buffer;
27mod options;
28mod run_end_import;
29mod scalar;
30mod session;
31
32pub use convert::IntoVortexArray;
33pub use convert::nulls;
34pub use datum::*;
35pub use executor::*;
36pub use iter::*;
37pub use null_buffer::to_arrow_null_buffer;
38pub use null_buffer::to_null_buffer;
39pub use options::*;
40pub use scalar::ToArrowDatum;
41pub use session::*;
42
43/// Register vortex-arrow's session extensions into `session`.
44///
45/// This eagerly registers the [`ArrowSession`], which is otherwise created lazily on first use.
46pub fn initialize(session: &VortexSession) {
47 session.register(ArrowSession::default());
48}