vortex_array/arrays/repeated/mod.rs
1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright the Vortex contributors
3
4//! An in-memory encoding that repeats a child array end to end.
5//!
6//! Row `i` of a [`RepeatedArray`] with child `c` is row `i % c.len()` of `c`. Its length is any
7//! number of rows, so the last repetition may be cut short: repeating `[1, 2, 3]` to 7 rows gives
8//! `[1, 2, 3, 1, 2, 3, 1]`. Any slice of a `RepeatedArray` is therefore another `RepeatedArray`
9//! over the child rotated to the slice's start, or a slice of the child.
10//!
11//! Execution decodes the child once. A nested child (struct, list, fixed-size list, extension or
12//! Variant) then executes to the same container over repeated children, so no values are copied;
13//! any other child is appended once per copy.
14//!
15//! `Repeated` has no wire form, so the default [`ArraySession`] does not register it, and an array
16//! that holds a `Repeated` cannot be serialized.
17//!
18//! [`ArraySession`]: crate::session::ArraySession
19
20mod array;
21mod rules;
22mod vtable;
23
24pub use array::RepeatedArraySlotsExt;
25pub use array::RepeatedSlots;
26pub use array::RepeatedSlotsView;
27pub use vtable::Repeated;
28pub use vtable::RepeatedArray;
29
30pub(crate) fn initialize(session: &vortex_session::VortexSession) {
31 rules::register_parent_rules(session);
32}
33
34#[cfg(test)]
35mod tests;