• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

vortex-data / vortex / 16204612549

10 Jul 2025 07:50PM UTC coverage: 81.152% (+2.9%) from 78.263%
16204612549

Pull #3825

github

web-flow
Merge d0d2717da into be9c2fd3e
Pull Request #3825: feat: Add optimize ArrayOp with VBView implementation

178 of 211 new or added lines in 4 files covered. (84.36%)

330 existing lines in 34 files now uncovered.

45433 of 55985 relevant lines covered (81.15%)

145951.87 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/vortex-array/src/vtable/operations.rs
1
// SPDX-License-Identifier: Apache-2.0
2
// SPDX-FileCopyrightText: Copyright the Vortex contributors
3

4
use vortex_error::VortexResult;
5
use vortex_scalar::Scalar;
6

7
use crate::ArrayRef;
8
use crate::vtable::VTable;
9

10
pub trait OperationsVTable<V: VTable> {
11
    /// Perform a constant-time slice of the array.
12
    ///
13
    /// If an encoding cannot perform this slice in constant time, it should internally
14
    /// store an offset and length in order to defer slicing until the array is accessed.
15
    ///
16
    /// This function returns [`ArrayRef`] since some encodings can return a simpler array for
17
    /// some slices, for example a [`crate::arrays::ChunkedArray`] may slice into a single chunk.
18
    ///
19
    /// ## Preconditions
20
    ///
21
    /// Bounds-checking has already been performed by the time this function is called.
22
    fn slice(array: &V::Array, start: usize, stop: usize) -> VortexResult<ArrayRef>;
23

24
    /// Fetch the scalar at the given index.
25
    ///
26
    /// ## Preconditions
27
    ///
28
    /// Bounds-checking has already been performed by the time this function is called,
29
    /// and the index is guaranteed to be non-null.
30
    fn scalar_at(array: &V::Array, index: usize) -> VortexResult<Scalar>;
31

32
    /// Return an optimized copy of an Array, with any unreferenced data blocks freed and
33
    /// any extraneous information removed.
34
    ///
35
    /// Many simple contiguous array types do not benefit from this operation, but it is
36
    /// especially useful for variable-length types which keep a variable number of buffers
37
    /// that can be dereferenced by other internal data structures via simple zero-copy
38
    /// filter and take operations. After multiple operations are applied to these arrays, it is
39
    /// common for the majority of owned buffer data to no longer logically be referenced.
40
    ///
41
    /// This operation can be called to return a new copy of an array with the same encoding,
42
    /// but with all unreferenced data unlinked.
43
    ///
44
    /// ## Default behavior
45
    ///
46
    /// For most arrays that do not contain variable buffer counts, such as the canonical
47
    /// arrays, the default implementation will not attempt to perform compaction and instead
48
    /// return the original array.
NEW
49
    fn optimize(array: &V::Array) -> VortexResult<V::Array> {
×
NEW
50
        Ok(array.clone())
×
NEW
51
    }
×
52
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc