Skip to content

Commit

Permalink
Minor: add test for pushdown past unnest (apache#11017)
Browse files Browse the repository at this point in the history
  • Loading branch information
alamb authored and xinlifoobar committed Jun 22, 2024
1 parent 1522905 commit 9cf3e9e
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions datafusion/sqllogictest/test_files/push_down_filter.slt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,25 @@ logical_plan
05)--------Projection: v.column2 AS unnest(v.column2), v.column1
06)----------TableScan: v projection=[column1, column2]

query II
select uc2, column1 from (select unnest(column2) as uc2, column1 from v) where uc2 > 3 AND column1 = 2;
----
4 2
5 2

# Could push the filter (column1 = 2) down below unnest
# https://github.com/apache/datafusion/issues/11016
query TT
explain select uc2, column1 from (select unnest(column2) as uc2, column1 from v) where uc2 > 3 AND column1 = 2;
----
logical_plan
01)Projection: unnest(v.column2) AS uc2, v.column1
02)--Filter: unnest(v.column2) > Int64(3) AND v.column1 = Int64(2)
03)----Unnest: lists[unnest(v.column2)] structs[]
04)------Projection: v.column2 AS unnest(v.column2), v.column1
05)--------TableScan: v projection=[column1, column2]


statement ok
drop table v;

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



statement ok
drop table d;

0 comments on commit 9cf3e9e

Please sign in to comment.