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

vortex-data / vortex / 16728097825

04 Aug 2025 04:00PM UTC coverage: 48.355% (-35.1%) from 83.429%
16728097825

Pull #4108

github

web-flow
Merge 1b2d27fd8 into 649ba9576
Pull Request #4108: perf[vortex-array]: use all_valid instead of `invalid_count() == 0`

1 of 1 new or added line in 1 file covered. (100.0%)

11596 existing lines in 378 files now uncovered.

18635 of 38538 relevant lines covered (48.35%)

151786.4 hits per line

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

90.0
/vortex-expr/src/transform/immediate_access.rs
1
// SPDX-License-Identifier: Apache-2.0
2
// SPDX-FileCopyrightText: Copyright the Vortex contributors
3

4
use vortex_dtype::{FieldName, StructFields};
5
use vortex_error::VortexExpect;
6
use vortex_utils::aliases::hash_set::HashSet;
7

8
use crate::transform::annotations::{AnnotationFn, Annotations, descendent_annotations};
9
use crate::{ExprRef, GetItemVTable, SelectVTable, is_root};
10

11
pub type FieldAccesses<'a> = Annotations<'a, FieldName>;
12

13
/// An [`AnnotationFn`] for annotating scope accesses.
14
pub fn annotate_scope_access(scope: &StructFields) -> impl AnnotationFn<Annotation = FieldName> {
2,234✔
15
    move |expr: &ExprRef| {
8,970✔
16
        assert!(
8,970✔
17
            !expr.is::<SelectVTable>(),
8,970✔
18
            "cannot analyse select, simplify the expression"
×
19
        );
20

21
        if let Some(get_item) = expr.as_opt::<GetItemVTable>() {
8,970✔
22
            if is_root(get_item.child()) {
4,976✔
23
                return vec![get_item.field().clone()];
4,976✔
UNCOV
24
            }
×
25
        } else if is_root(expr) {
3,994✔
UNCOV
26
            return scope.names().iter().cloned().collect();
×
27
        }
3,994✔
28

29
        vec![]
3,994✔
30
    }
8,970✔
31
}
2,234✔
32

33
/// For all subexpressions in an expression, find the fields that are accessed directly from the
34
/// scope, but not any fields in those fields
35
/// e.g. scope = {a: {b: .., c: ..}, d: ..}, expr = root().a.b + root().d accesses {a,d} (not b).
36
///
37
/// Note: This is a very naive, but simple analysis to find the fields that are accessed directly on an
38
/// identity node. This is combined to provide an over-approximation of the fields that are accessed
39
/// by an expression.
40
pub fn immediate_scope_accesses<'a>(
1,102✔
41
    expr: &'a ExprRef,
1,102✔
42
    scope: &'a StructFields,
1,102✔
43
) -> FieldAccesses<'a> {
1,102✔
44
    descendent_annotations(expr, annotate_scope_access(scope))
1,102✔
45
}
1,102✔
46

47
/// This returns the immediate scope_access (as explained `immediate_scope_accesses`) for `expr`.
48
pub fn immediate_scope_access<'a>(
1,102✔
49
    expr: &'a ExprRef,
1,102✔
50
    scope: &'a StructFields,
1,102✔
51
) -> HashSet<FieldName> {
1,102✔
52
    immediate_scope_accesses(expr, scope)
1,102✔
53
        .get(expr)
1,102✔
54
        .vortex_expect("Expression missing from scope accesses, this is a internal bug")
1,102✔
55
        .clone()
1,102✔
56
}
1,102✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc