GitHub user viirya opened a pull request:

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

    [SPARK-14191][SQL] Fix Expand operator constraints

    ## What changes were proposed in this pull request?
    JIRA: https://issues.apache.org/jira/browse/SPARK-14191
    
    `Expand` operator now uses its child plan's constraints as its valid 
constraints (i.e., the base of constraints). This is not correct because 
`Expand` will set its group by attributes to null values. So the nullability of 
these attributes should be true.
    
    E.g., for an `Expand` operator like:
    
        val input = LocalRelation('a.int, 'b.int, 'c.int).where('c.attr > 10 && 
'a.attr < 5 && 'b.attr > 2)
        Expand(
          Seq(
            Seq('c, Literal.create(null, StringType), 1),
            Seq('c, 'a, 2)),
          Seq('c, 'a, 'gid.int),
          Project(Seq('a, 'c), input))
    
    The `Project` operator has the constraints `IsNotNull('a)`, `IsNotNull('b)` 
and `IsNotNull('c)`. But the `Expand` should not have `IsNotNull('a)` in its 
constraints. 
    
    ## How was this patch tested?
    
    A test is added to `ConstraintPropagationSuite`.


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

    $ git pull https://github.com/viirya/spark-1 fix-expand-constraints

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

    https://github.com/apache/spark/pull/11995.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 #11995
    
----
commit 84821b45c23dcd8ad4889de2f0b802918276aa91
Author: Liang-Chi Hsieh <[email protected]>
Date:   2016-03-28T08:31:34Z

    Fix Expand constraints.

----


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to