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

vortex-data / vortex / 16788501099

06 Aug 2025 09:02PM UTC coverage: 83.872% (-0.2%) from 84.031%
16788501099

Pull #4144

github

web-flow
Merge 61157d119 into d44d33cce
Pull Request #4144: [WIP] Datafusion-related crimes

34 of 140 new or added lines in 7 files covered. (24.29%)

1 existing line in 1 file now uncovered.

48336 of 57631 relevant lines covered (83.87%)

519763.96 hits per line

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

85.71
/vortex-datafusion/src/convert/expr.rs
1
// SPDX-License-Identifier: Apache-2.0
2
// SPDX-FileCopyrightText: Copyright the Vortex contributors
3

4
use std::sync::Arc;
5

6
use datafusion::logical_expr::Operator as DFOperator;
7
use datafusion::physical_expr::{PhysicalExpr, expressions};
8
use vortex::error::{VortexResult, vortex_bail, vortex_err};
9
use vortex::expr::{BinaryExpr, ExprRef, IntoExpr, LikeExpr, Operator, get_item, lit, root};
10
use vortex::scalar::Scalar;
11

12
use crate::convert::{DFDynamicExpr, FromDataFusion, TryFromDataFusion};
13

14
// TODO(joe): Don't return an error when we have an unsupported node, bubble up "TRUE" as in keep
15
//  for that node, up to any `and` or `or` node.
16
impl TryFromDataFusion<Arc<dyn PhysicalExpr>> for ExprRef {
17
    fn try_from_df(df: &Arc<dyn PhysicalExpr>) -> VortexResult<Self> {
380✔
18
        if let Some(binary_expr) = df.as_any().downcast_ref::<expressions::BinaryExpr>() {
380✔
19
            let left = ExprRef::try_from_df(binary_expr.left())?;
120✔
20
            let right = ExprRef::try_from_df(binary_expr.right())?;
120✔
21
            let operator = Operator::try_from_df(binary_expr.op())?;
120✔
22

23
            return Ok(BinaryExpr::new_expr(left, operator, right));
120✔
24
        }
260✔
25

26
        if let Some(col_expr) = df.as_any().downcast_ref::<expressions::Column>() {
260✔
27
            return Ok(get_item(col_expr.name().to_owned(), root()));
134✔
28
        }
126✔
29

30
        if let Some(like) = df.as_any().downcast_ref::<expressions::LikeExpr>() {
126✔
31
            let child = ExprRef::try_from_df(like.expr())?;
12✔
32
            let pattern = ExprRef::try_from_df(like.pattern())?;
12✔
33
            return Ok(
12✔
34
                LikeExpr::new(child, pattern, like.negated(), like.case_insensitive()).into_expr(),
12✔
35
            );
12✔
36
        }
114✔
37

38
        if df
114✔
39
            .as_any()
114✔
40
            .downcast_ref::<expressions::DynamicFilterPhysicalExpr>()
114✔
41
            .is_some()
114✔
42
        {
NEW
43
            return DFDynamicExpr::try_new_expr(df.clone());
×
44
        }
114✔
45

46
        if let Some(literal) = df.as_any().downcast_ref::<expressions::Literal>() {
114✔
47
            let value = Scalar::from_df(literal.value());
114✔
48
            return Ok(lit(value));
114✔
49
        }
×
50

51
        vortex_bail!("Couldn't convert DataFusion physical {df} expression to a vortex expression")
×
52
    }
380✔
53
}
54

55
impl TryFromDataFusion<DFOperator> for Operator {
56
    fn try_from_df(value: &DFOperator) -> VortexResult<Self> {
120✔
57
        match value {
120✔
58
            DFOperator::Eq => Ok(Operator::Eq),
48✔
59
            DFOperator::NotEq => Ok(Operator::NotEq),
2✔
60
            DFOperator::Lt => Ok(Operator::Lt),
22✔
61
            DFOperator::LtEq => Ok(Operator::Lte),
6✔
62
            DFOperator::Gt => Ok(Operator::Gt),
10✔
63
            DFOperator::GtEq => Ok(Operator::Gte),
24✔
64
            DFOperator::And => Ok(Operator::And),
×
65
            DFOperator::Or => Ok(Operator::Or),
8✔
NEW
66
            DFOperator::Plus => Ok(Operator::Add),
×
67
            DFOperator::IsDistinctFrom
68
            | DFOperator::IsNotDistinctFrom
69
            | DFOperator::RegexMatch
70
            | DFOperator::RegexIMatch
71
            | DFOperator::RegexNotMatch
72
            | DFOperator::RegexNotIMatch
73
            | DFOperator::LikeMatch
74
            | DFOperator::ILikeMatch
75
            | DFOperator::NotLikeMatch
76
            | DFOperator::NotILikeMatch
77
            | DFOperator::BitwiseAnd
78
            | DFOperator::BitwiseOr
79
            | DFOperator::BitwiseXor
80
            | DFOperator::BitwiseShiftRight
81
            | DFOperator::BitwiseShiftLeft
82
            | DFOperator::StringConcat
83
            | DFOperator::AtArrow
84
            | DFOperator::ArrowAt
85
            | DFOperator::Minus
86
            | DFOperator::Multiply
87
            | DFOperator::Divide
88
            | DFOperator::Modulo
89
            | DFOperator::Arrow
90
            | DFOperator::LongArrow
91
            | DFOperator::HashArrow
92
            | DFOperator::HashLongArrow
93
            | DFOperator::AtAt
94
            | DFOperator::IntegerDivide
95
            | DFOperator::HashMinus
96
            | DFOperator::AtQuestion
97
            | DFOperator::Question
98
            | DFOperator::QuestionAnd
99
            | DFOperator::QuestionPipe => {
100
                Err(vortex_err!("Unsupported datafusion operator {value}"))
×
101
            }
102
        }
103
    }
120✔
104
}
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