Skip to content

Commit 2f76a91

Browse files
committed
add anti test
1 parent c5c04e5 commit 2f76a91

File tree

1 file changed

+45
-0
lines changed
  • datafusion/core/tests/physical_optimizer/filter_pushdown

1 file changed

+45
-0
lines changed

datafusion/core/tests/physical_optimizer/filter_pushdown/mod.rs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,51 @@ async fn test_hashjoin_parent_filter_pushdown() {
220220
- DataSourceExec: file_groups={1 group: [[test.parquet]]}, projection=[d, e, f], file_type=test, pushdown_supported=true, predicate=e@1 = ba
221221
"
222222
);
223+
224+
// Test left join - filters should NOT be pushed down
225+
let join = Arc::new(
226+
HashJoinExec::try_new(
227+
TestScanBuilder::new(Arc::clone(&build_side_schema))
228+
.with_support(true)
229+
.build(),
230+
TestScanBuilder::new(Arc::clone(&probe_side_schema))
231+
.with_support(true)
232+
.build(),
233+
vec![(
234+
col("a", &build_side_schema).unwrap(),
235+
col("d", &probe_side_schema).unwrap(),
236+
)],
237+
None,
238+
&JoinType::Left,
239+
None,
240+
PartitionMode::Partitioned,
241+
datafusion_common::NullEquality::NullEqualsNothing,
242+
)
243+
.unwrap(),
244+
);
245+
246+
let join_schema = join.schema();
247+
let filter = col_lit_predicate("a", "aa", &join_schema);
248+
let plan = Arc::new(FilterExec::try_new(filter, join).unwrap());
249+
250+
// Test that filters are NOT pushed down for left join
251+
insta::assert_snapshot!(
252+
OptimizationTest::new(plan, FilterPushdown::new(), true),
253+
@r"
254+
OptimizationTest:
255+
input:
256+
- FilterExec: a@0 = aa
257+
- HashJoinExec: mode=Partitioned, join_type=Left, on=[(a@0, d@0)]
258+
- DataSourceExec: file_groups={1 group: [[test.parquet]]}, projection=[a, b, c], file_type=test, pushdown_supported=true
259+
- DataSourceExec: file_groups={1 group: [[test.parquet]]}, projection=[d, e, f], file_type=test, pushdown_supported=true
260+
output:
261+
Ok:
262+
- FilterExec: a@0 = aa
263+
- HashJoinExec: mode=Partitioned, join_type=Left, on=[(a@0, d@0)]
264+
- DataSourceExec: file_groups={1 group: [[test.parquet]]}, projection=[a, b, c], file_type=test, pushdown_supported=true, predicate=true
265+
- DataSourceExec: file_groups={1 group: [[test.parquet]]}, projection=[d, e, f], file_type=test, pushdown_supported=true, predicate=true
266+
"
267+
);
223268
}
224269

225270
#[test]

0 commit comments

Comments
 (0)