Skip to content

Commit 2862c98

Browse files
discord9adriangb
authored andcommitted
test: more complex dyn filter
Signed-off-by: discord9 <[email protected]>
1 parent d363d98 commit 2862c98

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
@@ -1112,7 +1112,7 @@ mod tests {
11121112

11131113
use datafusion_expr::Operator;
11141114
use datafusion_physical_expr::expressions::{
1115-
BinaryExpr, Column, DynamicFilterPhysicalExpr, Literal, col, lit,
1115+
BinaryExpr, Column, DynamicFilterPhysicalExpr, Literal, binary, col, lit,
11161116
};
11171117

11181118
#[test]
@@ -1596,10 +1596,16 @@ mod tests {
15961596
input_schema.as_ref().clone(),
15971597
));
15981598

1599-
// project "b" as "a"
1599+
// project "b" - 1 as "a"
16001600
let projection = ProjectionExec::try_new(
16011601
vec![ProjectionExpr {
1602-
expr: Arc::new(Column::new("b", 0)),
1602+
expr: binary(
1603+
Arc::new(Column::new("b", 0)),
1604+
Operator::Minus,
1605+
lit(1),
1606+
&input_schema,
1607+
)
1608+
.unwrap(),
16031609
alias: "a".to_string(),
16041610
}],
16051611
input,
@@ -1641,10 +1647,10 @@ mod tests {
16411647
let current = dynamic_filter.current()?;
16421648
assert_eq!(format!("{current}"), "a@0 > 5");
16431649

1644-
// Check currently pushed_filters is b > 5 (because b is projected as a)
1650+
// Check currently pushed_filters is b - 1 > 5 (because b - 1 is projected as a)
16451651
assert_eq!(
16461652
format!("{}", pushed_filters.predicate),
1647-
"DynamicFilter [ b@0 > 5 ]"
1653+
"DynamicFilter [ b@0 - 1 > 5 ]"
16481654
);
16491655

16501656
Ok(())

0 commit comments

Comments
 (0)