Skip to content

Commit 7a9f0c5

Browse files
committed
test: more complex dyn filter
Signed-off-by: discord9 <[email protected]>
1 parent 33c07fc commit 7a9f0c5

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

datafusion/physical-plan/src/projection.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,7 @@ mod tests {
10411041

10421042
use datafusion_expr::Operator;
10431043
use datafusion_physical_expr::expressions::{
1044-
BinaryExpr, Column, DynamicFilterPhysicalExpr, Literal, col, lit,
1044+
BinaryExpr, Column, DynamicFilterPhysicalExpr, Literal, binary, col, lit,
10451045
};
10461046

10471047
#[test]
@@ -1525,10 +1525,16 @@ mod tests {
15251525
input_schema.as_ref().clone(),
15261526
));
15271527

1528-
// project "b" as "a"
1528+
// project "b" - 1 as "a"
15291529
let projection = ProjectionExec::try_new(
15301530
vec![ProjectionExpr {
1531-
expr: Arc::new(Column::new("b", 0)),
1531+
expr: binary(
1532+
Arc::new(Column::new("b", 0)),
1533+
Operator::Minus,
1534+
lit(1),
1535+
&input_schema,
1536+
)
1537+
.unwrap(),
15321538
alias: "a".to_string(),
15331539
}],
15341540
input,
@@ -1570,10 +1576,10 @@ mod tests {
15701576
let current = dynamic_filter.current()?;
15711577
assert_eq!(format!("{current}"), "a@0 > 5");
15721578

1573-
// Check currently pushed_filters is b > 5 (because b is projected as a)
1579+
// Check currently pushed_filters is b - 1 > 5 (because b - 1 is projected as a)
15741580
assert_eq!(
15751581
format!("{}", pushed_filters.predicate),
1576-
"DynamicFilter [ b@0 > 5 ]"
1582+
"DynamicFilter [ b@0 - 1 > 5 ]"
15771583
);
15781584

15791585
Ok(())

0 commit comments

Comments
 (0)