vortex_array/
lib.rs

1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright the Vortex contributors
3
4#![cfg_attr(vortex_nightly, feature(portable_simd))]
5//! Vortex crate containing core logic for encoding and memory representation of [arrays](ArrayRef).
6//!
7//! At the heart of Vortex are [arrays](ArrayRef) and [encodings](vtable::ArrayVTable).
8//! Arrays are typed views of memory buffers that hold [scalars](vortex_scalar::Scalar). These
9//! buffers can be held in a number of physical encodings to perform lightweight compression that
10//! exploits the particular data distribution of the array's values.
11//!
12//! Every data type recognized by Vortex also has a canonical physical encoding format, which
13//! arrays can be [canonicalized](Canonical) into for ease of access in compute functions.
14
15use std::sync::LazyLock;
16
17pub use array::*;
18pub use canonical::*;
19pub use context::*;
20pub use executor::*;
21pub use hash::*;
22pub use mask_future::*;
23pub use metadata::*;
24use vortex_session::VortexSession;
25
26use crate::session::ArraySession;
27
28pub mod accessor;
29#[doc(hidden)]
30pub mod aliases;
31mod array;
32pub mod arrays;
33pub mod arrow;
34pub mod buffer;
35pub mod builders;
36pub mod builtins;
37mod canonical;
38pub mod compute;
39mod context;
40pub mod display;
41mod executor;
42pub mod expr;
43mod expression;
44mod hash;
45pub mod iter;
46pub mod kernel;
47pub mod mask;
48mod mask_future;
49pub mod matchers;
50mod metadata;
51pub mod optimizer;
52mod partial_ord;
53pub mod patches;
54pub mod search_sorted;
55pub mod serde;
56pub mod session;
57pub mod stats;
58pub mod stream;
59#[cfg(any(test, feature = "test-harness"))]
60pub mod test_harness;
61pub mod validity;
62pub mod variants;
63pub mod vectors;
64pub mod vtable;
65
66pub mod flatbuffers {
67    //! Re-exported autogenerated code from the core Vortex flatbuffer definitions.
68    pub use vortex_flatbuffers::array::*;
69}
70
71static USE_VORTEX_OPERATORS: LazyLock<bool> = LazyLock::new(|| {
72    std::env::var("VORTEX_OPERATORS")
73        .map(|v| v == "1" || v.to_lowercase() == "true")
74        .unwrap_or(false)
75});
76
77// TODO(ngates): canonicalize doesn't currently take a session, therefore we cannot invoke execute
78//  from the new array encodings to support back-compat for legacy encodings. So we hold a session
79//  here...
80static LEGACY_SESSION: LazyLock<VortexSession> =
81    LazyLock::new(|| VortexSession::empty().with::<ArraySession>());