Skip to content

Commit 4623d33

Browse files
committed
add slt test
1 parent a778163 commit 4623d33

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

datafusion/sqllogictest/test_files/push_down_filter.slt

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,5 +286,37 @@ explain select a from t where CAST(a AS string) = '0123';
286286
physical_plan DataSourceExec: file_groups={1 group: [[WORKSPACE_ROOT/datafusion/sqllogictest/test_files/scratch/push_down_filter/t.parquet]]}, projection=[a], file_type=parquet, predicate=CAST(a@0 AS Utf8View) = 0123
287287

288288

289+
# Test dynamic filter pushdown with swapped join inputs (issue #17196)
290+
# Create tables with different sizes to force join input swapping
291+
statement ok
292+
copy (select i as k from generate_series(1, 100) t(i)) to 'test_files/scratch/push_down_filter/small_table.parquet';
293+
294+
statement ok
295+
copy (select i as k, i as v from generate_series(1, 1000) t(i)) to 'test_files/scratch/push_down_filter/large_table.parquet';
296+
297+
statement ok
298+
create external table small_table stored as parquet location 'test_files/scratch/push_down_filter/small_table.parquet';
299+
300+
statement ok
301+
create external table large_table stored as parquet location 'test_files/scratch/push_down_filter/large_table.parquet';
302+
303+
# Test that dynamic filter is applied to the correct table after join input swapping
304+
# The small_table should be the build side, large_table should be the probe side with dynamic filter
305+
query TT
306+
explain select * from small_table join large_table on small_table.k = large_table.k where large_table.v >= 50;
307+
----
308+
physical_plan
309+
01)CoalesceBatchesExec: target_batch_size=8192
310+
02)--HashJoinExec: mode=CollectLeft, join_type=Inner, on=[(k@0, k@0)]
311+
03)----DataSourceExec: file_groups={1 group: [[WORKSPACE_ROOT/datafusion/sqllogictest/test_files/scratch/push_down_filter/small_table.parquet]]}, projection=[k], file_type=parquet
312+
04)----RepartitionExec: partitioning=RoundRobinBatch(4), input_partitions=1
313+
05)------DataSourceExec: file_groups={1 group: [[WORKSPACE_ROOT/datafusion/sqllogictest/test_files/scratch/push_down_filter/large_table.parquet]]}, projection=[k, v], file_type=parquet, predicate=v@1 >= 50 AND DynamicFilterPhysicalExpr [ true ], pruning_predicate=v_null_count@1 != row_count@2 AND v_max@0 >= 50, required_guarantees=[]
314+
315+
statement ok
316+
drop table small_table;
317+
318+
statement ok
319+
drop table large_table;
320+
289321
statement ok
290322
drop table t;

0 commit comments

Comments
 (0)