@@ -258,6 +258,51 @@ async fn test_hashjoin_parent_filter_pushdown() {
258258 - DataSourceExec: file_groups={1 group: [[test.parquet]]}, projection=[d, e, f], file_type=test, pushdown_supported=true, predicate=e@1 = ba
259259 "
260260 ) ;
261+
262+ // Test left join - filters should NOT be pushed down
263+ let join = Arc :: new (
264+ HashJoinExec :: try_new (
265+ TestScanBuilder :: new ( Arc :: clone ( & build_side_schema) )
266+ . with_support ( true )
267+ . build ( ) ,
268+ TestScanBuilder :: new ( Arc :: clone ( & probe_side_schema) )
269+ . with_support ( true )
270+ . build ( ) ,
271+ vec ! [ (
272+ col( "a" , & build_side_schema) . unwrap( ) ,
273+ col( "d" , & probe_side_schema) . unwrap( ) ,
274+ ) ] ,
275+ None ,
276+ & JoinType :: Left ,
277+ None ,
278+ PartitionMode :: Partitioned ,
279+ datafusion_common:: NullEquality :: NullEqualsNothing ,
280+ )
281+ . unwrap ( ) ,
282+ ) ;
283+
284+ let join_schema = join. schema ( ) ;
285+ let filter = col_lit_predicate ( "a" , "aa" , & join_schema) ;
286+ let plan = Arc :: new ( FilterExec :: try_new ( filter, join) . unwrap ( ) ) ;
287+
288+ // Test that filters are NOT pushed down for left join
289+ insta:: assert_snapshot!(
290+ OptimizationTest :: new( plan, FilterPushdown :: new( ) , true ) ,
291+ @r"
292+ OptimizationTest:
293+ input:
294+ - FilterExec: a@0 = aa
295+ - HashJoinExec: mode=Partitioned, join_type=Left, on=[(a@0, d@0)]
296+ - DataSourceExec: file_groups={1 group: [[test.parquet]]}, projection=[a, b, c], file_type=test, pushdown_supported=true
297+ - DataSourceExec: file_groups={1 group: [[test.parquet]]}, projection=[d, e, f], file_type=test, pushdown_supported=true
298+ output:
299+ Ok:
300+ - FilterExec: a@0 = aa
301+ - HashJoinExec: mode=Partitioned, join_type=Left, on=[(a@0, d@0)]
302+ - DataSourceExec: file_groups={1 group: [[test.parquet]]}, projection=[a, b, c], file_type=test, pushdown_supported=true, predicate=true
303+ - DataSourceExec: file_groups={1 group: [[test.parquet]]}, projection=[d, e, f], file_type=test, pushdown_supported=true, predicate=true
304+ "
305+ ) ;
261306}
262307
263308#[ test]
0 commit comments