Skip to content

Commit 1e7c38b

Browse files
authored
Minor: add test for pushdown past unnest (#11017)
1 parent 61e2ddb commit 1e7c38b

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

datafusion/sqllogictest/test_files/push_down_filter.slt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,25 @@ logical_plan
6060
05)--------Projection: v.column2 AS unnest(v.column2), v.column1
6161
06)----------TableScan: v projection=[column1, column2]
6262

63+
query II
64+
select uc2, column1 from (select unnest(column2) as uc2, column1 from v) where uc2 > 3 AND column1 = 2;
65+
----
66+
4 2
67+
5 2
68+
69+
# Could push the filter (column1 = 2) down below unnest
70+
# https://github.com/apache/datafusion/issues/11016
71+
query TT
72+
explain select uc2, column1 from (select unnest(column2) as uc2, column1 from v) where uc2 > 3 AND column1 = 2;
73+
----
74+
logical_plan
75+
01)Projection: unnest(v.column2) AS uc2, v.column1
76+
02)--Filter: unnest(v.column2) > Int64(3) AND v.column1 = Int64(2)
77+
03)----Unnest: lists[unnest(v.column2)] structs[]
78+
04)------Projection: v.column2 AS unnest(v.column2), v.column1
79+
05)--------TableScan: v projection=[column1, column2]
80+
81+
6382
statement ok
6483
drop table v;
6584

@@ -82,5 +101,7 @@ logical_plan
82101
04)------Projection: d.column1, d.column2 AS unnest(d.column2)
83102
05)--------TableScan: d projection=[column1, column2]
84103

104+
105+
85106
statement ok
86107
drop table d;

0 commit comments

Comments
 (0)