vortex-arrow 0.92.0

Apache Arrow interoperability for Vortex arrays
Documentation
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright the Vortex contributors

//! Apache Arrow interoperability for Vortex.
//!
//! This crate owns every conversion between Vortex and Arrow. The authoritative entry point is
//! the [`ArrowSession`]: importing Arrow schemas, fields, and data types into Vortex
//! ([`ArrowSession::from_arrow_schema`], [`ArrowSession::from_arrow_field`],
//! [`ArrowSession::from_arrow_datatype`]), importing Arrow arrays and record batches
//! ([`ArrowSession::from_arrow_array`], [`ArrowSession::from_arrow_record_batch`]),
//! exporting Vortex dtypes to Arrow
//! ([`ArrowSession::to_arrow_schema`], [`ArrowSession::to_arrow_field`],
//! [`ArrowSession::to_arrow_datatype`]), and executing Vortex arrays into Arrow
//! ([`ArrowSession::execute_arrow`] and the [`ArrowArrayExecutor`] convenience trait).
//!
//! The [`ArrowSession`] session variable is created lazily on first use of
//! [`ArrowSessionExt::arrow`], so no explicit registration is required for plain conversions.
//! To import extension types that have no Arrow plugin, register the session with [`initialize`]
//! (see [`ArrowSession`]).

use vortex_array::dtype::session::DTypeSessionExt;
use vortex_session::VortexSession;

pub mod convert;
mod datum;
pub mod dtype;
mod executor;
mod iter;
mod null_buffer;
mod options;
mod run_end_import;
mod scalar;
mod session;
#[cfg(test)]
mod tests;

pub use convert::IntoVortexArray;
pub use convert::nulls;
pub use datum::*;
pub use executor::*;
pub use iter::*;
pub use null_buffer::to_arrow_null_buffer;
pub use null_buffer::to_null_buffer;
pub use options::*;
pub use scalar::ToArrowDatum;
pub use session::*;

/// Register vortex-arrow's session extensions into `session`.
///
/// This eagerly registers the [`ArrowSession`], which is otherwise created lazily on first use.
/// Only a session registered here can look up the extension types of `session` by their Vortex IDs.
/// A session that is created lazily on first use cannot, so it imports an extension type without an
/// Arrow plugin as plain storage.
pub fn initialize(session: &VortexSession) {
    session.register(ArrowSession::new(&session.dtypes()));
}