diff --git a/datafusion/sqllogictest/test_files/push_down_filter.slt b/datafusion/sqllogictest/test_files/push_down_filter.slt index 368243f9669bb..5029ab170a18e 100644 --- a/datafusion/sqllogictest/test_files/push_down_filter.slt +++ b/datafusion/sqllogictest/test_files/push_down_filter.slt @@ -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; @@ -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;