-
- Downloads
[SPARK-16994][SQL] Whitelist operators for predicate pushdown
## What changes were proposed in this pull request? This patch changes predicate pushdown optimization rule (PushDownPredicate) from using a blacklist to a whitelist. That is to say, operators must be explicitly allowed. This approach is more future-proof: previously it was possible for us to introduce a new operator and then render the optimization rule incorrect. This also fixes the bug that previously we allowed pushing filter beneath limit, which was incorrect. That is to say, before this patch, the optimizer would rewrite ``` select * from (select * from range(10) limit 5) where id > 3 to select * from range(10) where id > 3 limit 5 ``` ## How was this patch tested? - a unit test case in FilterPushdownSuite - an end-to-end test in limit.sql Author: Reynold Xin <rxin@databricks.com> Closes #14713 from rxin/SPARK-16994.
Showing
- sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala 17 additions, 6 deletions...a/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
- sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/FilterPushdownSuite.scala 6 additions, 0 deletions...he/spark/sql/catalyst/optimizer/FilterPushdownSuite.scala
- sql/core/src/test/resources/sql-tests/inputs/limit.sql 3 additions, 0 deletionssql/core/src/test/resources/sql-tests/inputs/limit.sql
- sql/core/src/test/resources/sql-tests/results/limit.sql.out 9 additions, 1 deletionsql/core/src/test/resources/sql-tests/results/limit.sql.out
Loading
Please register or sign in to comment