GitHub user jiangxb1987 opened a pull request:

    https://github.com/apache/spark/pull/19099

    [SPARK-21652][SQL] Fix rule confliction between InferFiltersFromConstraints 
and ConstantPropagation

    ## What changes were proposed in this pull request?
    
    For the given example below, the predicate added by 
`InferFiltersFromConstraints` is folded by `ConstantPropagation` later, this 
leads to unconverged optimize iteration:
    ```
    Seq((1, 1)).toDF("col1", "col2").createOrReplaceTempView("t1")
    Seq(1, 2).toDF("col").createOrReplaceTempView("t2")
    sql("SELECT * FROM t1, t2 WHERE t1.col1 = 1 AND 1 = t1.col2 AND t1.col1 = 
t2.col AND t1.col2 = t2.col")
    ```
    
    We can fix this by adjusting the indent of the optimize rules.
    
    ## How was this patch tested?
    
    Add test case that would have failed in `SQLQuerySuite`.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jiangxb1987/spark unconverge-optimization

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/19099.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 #19099
    
----
commit 7a364a192f15bc99e362a2615c775730cb11fc24
Author: Xingbo Jiang <xingbo.ji...@databricks.com>
Date:   2017-08-31T21:49:02Z

    fix rule confliction between InferFiltersFromConstraints and 
ConstantPropagation.

----


---
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

Reply via email to