• 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

56.6
/vortex-expr/src/exprs/root.rs
1
// SPDX-License-Identifier: Apache-2.0
2
// SPDX-FileCopyrightText: Copyright the Vortex contributors
3

4
use std::fmt::Display;
5

6
use vortex_array::stats::Stat;
7
use vortex_array::{ArrayRef, DeserializeMetadata, EmptyMetadata};
8
use vortex_dtype::{DType, FieldPath};
9
use vortex_error::{VortexResult, vortex_bail};
10

11
use crate::{
12
    AnalysisExpr, ExprEncodingRef, ExprId, ExprRef, IntoExpr, Scope, StatsCatalog, VTable, vtable,
13
};
14

15
vtable!(Root);
16

17
/// An expression that returns the full scope of the expression evaluation.
18
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
19
pub struct RootExpr;
20

21
pub struct RootExprEncoding;
22

23
impl VTable for RootVTable {
24
    type Expr = RootExpr;
25
    type Encoding = RootExprEncoding;
26
    type Metadata = EmptyMetadata;
27

28
    fn id(_encoding: &Self::Encoding) -> ExprId {
22✔
29
        ExprId::new_ref("root")
22✔
30
    }
22✔
31

UNCOV
32
    fn encoding(_expr: &Self::Expr) -> ExprEncodingRef {
×
UNCOV
33
        ExprEncodingRef::new_ref(RootExprEncoding.as_ref())
×
UNCOV
34
    }
×
35

UNCOV
36
    fn metadata(_expr: &Self::Expr) -> Option<Self::Metadata> {
×
UNCOV
37
        Some(EmptyMetadata)
×
UNCOV
38
    }
×
39

40
    fn children(_expr: &Self::Expr) -> Vec<&ExprRef> {
118,112✔
41
        vec![]
118,112✔
42
    }
118,112✔
43

44
    fn with_children(expr: &Self::Expr, _children: Vec<ExprRef>) -> VortexResult<Self::Expr> {
×
45
        Ok(expr.clone())
×
46
    }
×
47

UNCOV
48
    fn build(
×
UNCOV
49
        _encoding: &Self::Encoding,
×
UNCOV
50
        _metadata: &<Self::Metadata as DeserializeMetadata>::Output,
×
UNCOV
51
        children: Vec<ExprRef>,
×
UNCOV
52
    ) -> VortexResult<Self::Expr> {
×
UNCOV
53
        if !children.is_empty() {
×
54
            vortex_bail!(
×
55
                "Root expression does not have children, got: {:?}",
×
56
                children
57
            );
UNCOV
58
        }
×
UNCOV
59
        Ok(RootExpr)
×
UNCOV
60
    }
×
61

62
    fn evaluate(_expr: &Self::Expr, scope: &Scope) -> VortexResult<ArrayRef> {
14,134✔
63
        Ok(scope.root().clone())
14,134✔
64
    }
14,134✔
65

66
    fn return_dtype(_expr: &Self::Expr, scope: &DType) -> VortexResult<DType> {
24,506✔
67
        Ok(scope.clone())
24,506✔
68
    }
24,506✔
69
}
70

71
impl Display for RootExpr {
UNCOV
72
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
×
UNCOV
73
        write!(f, "$")
×
UNCOV
74
    }
×
75
}
76

77
impl AnalysisExpr for RootExpr {
78
    fn max(&self, catalog: &mut dyn StatsCatalog) -> Option<ExprRef> {
268✔
79
        catalog.stats_ref(&self.field_path()?, Stat::Max)
268✔
80
    }
268✔
81

82
    fn min(&self, catalog: &mut dyn StatsCatalog) -> Option<ExprRef> {
272✔
83
        catalog.stats_ref(&self.field_path()?, Stat::Min)
272✔
84
    }
272✔
85

86
    fn nan_count(&self, catalog: &mut dyn StatsCatalog) -> Option<ExprRef> {
378✔
87
        catalog.stats_ref(&self.field_path()?, Stat::NaNCount)
378✔
88
    }
378✔
89

90
    fn field_path(&self) -> Option<FieldPath> {
1,612✔
91
        Some(FieldPath::root())
1,612✔
92
    }
1,612✔
93
}
94

95
/// Return a global pointer to the identity token.
96
/// This is the name of the data found in a vortex array or file.
97
pub fn root() -> ExprRef {
17,400✔
98
    RootExpr.into_expr()
17,400✔
99
}
17,400✔
100

101
/// Return whether the expression is a root expression.
102
pub fn is_root(expr: &ExprRef) -> bool {
22,270✔
103
    expr.is::<RootVTable>()
22,270✔
104
}
22,270✔
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