GitHub user dongjoon-hyun opened a pull request: https://github.com/apache/spark/pull/12267
[SPARK-14502][SQL] Add optimization for Non-Nullable Binary Comparison Simplification ## What changes were proposed in this pull request? For non-nullable binary comparisons, we can simplifies `semantically-equal expressions` further: - Replace '=', '<=', and '>=' with 'true' literal - Replace '<' and '>' with 'false' literal For example, the following example plan ``` scala> sql("SELECT * FROM (SELECT explode(array(1,2,3)) a) T WHERE a BETWEEN a AND a+7").explain() ... : +- Filter ((a#59 >= a#59) && (a#59 <= (a#59 + 7))) ... ``` will be optimized into the following. ``` : +- Filter (a#47 <= (a#47 + 7)) ``` ## How was this patch tested? Pass the Jenkins tests including new `NonNullableBinaryComparisonSimplificationSuite`. You can merge this pull request into a Git repository by running: $ git pull https://github.com/dongjoon-hyun/spark SPARK-14502 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/12267.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #12267 ---- commit 69fadfef81714adf34b346c9c56aed35d4d37ae1 Author: Dongjoon Hyun <dongj...@apache.org> Date: 2016-04-08T22:51:11Z [SPARK-14502][SQL] Add optimization for Non-Nullable Binary Comparison Simplification ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org