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

vortex-data / vortex / 16935267080

13 Aug 2025 11:00AM UTC coverage: 24.312% (-63.3%) from 87.658%
16935267080

Pull #4226

github

web-flow
Merge 81b48c7fb into baa6ea202
Pull Request #4226: Support converting TimestampTZ to and from duckdb

0 of 2 new or added lines in 1 file covered. (0.0%)

20666 existing lines in 469 files now uncovered.

8726 of 35892 relevant lines covered (24.31%)

147.74 hits per line

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

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

4
use vortex_error::{VortexResult, vortex_err};
5

6
use crate::traversal::{Node, Transformed};
7
use crate::{DType, ExprRef, SelectVTable, get_item, pack};
8

9
/// Replaces [crate::SelectExpr] with combination of [crate::GetItem] and [crate::Pack] expressions.
10
pub(crate) fn remove_select(e: ExprRef, ctx: &DType) -> VortexResult<ExprRef> {
14✔
11
    e.transform_up(|node| remove_select_transformer(node, ctx))
48✔
12
        .map(|e| e.into_inner())
14✔
13
}
14✔
14

15
fn remove_select_transformer(node: ExprRef, ctx: &DType) -> VortexResult<Transformed<ExprRef>> {
48✔
16
    match node.as_opt::<SelectVTable>() {
48✔
17
        None => Ok(Transformed::no(node)),
48✔
UNCOV
18
        Some(select) => {
×
UNCOV
19
            let child = select.child();
×
UNCOV
20
            let child_dtype = child.return_dtype(ctx)?;
×
UNCOV
21
            let child_nullability = child_dtype.nullability();
×
22

UNCOV
23
            let child_dtype = child_dtype.as_struct().ok_or_else(|| {
×
24
                vortex_err!(
×
25
                    "Select child must return a struct dtype, however it was a {}",
×
26
                    child_dtype
27
                )
28
            })?;
×
29

UNCOV
30
            let expr = pack(
×
UNCOV
31
                select
×
UNCOV
32
                    .fields()
×
UNCOV
33
                    .as_include_names(child_dtype.names())
×
UNCOV
34
                    .map_err(|e| {
×
35
                        e.with_context(format!(
×
36
                            "Select fields {:?} must be a subset of child fields {:?}",
×
37
                            select.fields(),
×
38
                            child_dtype.names()
×
39
                        ))
40
                    })?
×
UNCOV
41
                    .iter()
×
UNCOV
42
                    .map(|name| (name.clone(), get_item(name.clone(), child.clone()))),
×
UNCOV
43
                child_nullability,
×
44
            );
45

UNCOV
46
            Ok(Transformed::yes(expr))
×
47
        }
48
    }
49
}
48✔
50

51
#[cfg(test)]
52
mod tests {
53

54
    use vortex_dtype::Nullability::Nullable;
55
    use vortex_dtype::PType::I32;
56
    use vortex_dtype::{DType, StructFields};
57

58
    use crate::transform::remove_select::remove_select;
59
    use crate::{PackVTable, root, select};
60

61
    #[test]
62
    fn test_remove_select() {
63
        let dtype = DType::Struct(
64
            StructFields::new(["a", "b"].into(), vec![I32.into(), I32.into()]),
65
            Nullable,
66
        );
67
        let e = select(["a", "b"], root());
68
        let e = remove_select(e, &dtype).unwrap();
69

70
        assert!(e.is::<PackVTable>());
71
        assert!(e.return_dtype(&dtype).unwrap().is_nullable());
72
    }
73
}
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