GitHub user watermen opened a pull request:

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

    [SPARK-15549][SQL] Bucket column only need to be found in the output of 
relation when use bucketed table

    ## What changes were proposed in this pull request?
    I create a bucketed table test(i int, j int, k int) with bucket column i, 
    ```scala
    case class Data(i: Int, j: Int, k: Int)
    sc.makeRDD(Array((1, 2, 3))).map(x => Data(x._1, x._2, 
x._3)).toDF.write.bucketBy(2, "i").saveAsTable("test")
    ```
    
    and I run the following SQL:
    ```sql
    SELECT j FROM test;
    Error in query: bucket column i not found in existing columns (j);
    
    SELECT j, MAX(k) FROM test GROUP BY j;
    Error in query: bucket column i not found in existing columns (j, k);
    ```
    
    I think the bucket column only need to be found in the output of relation. 
So the 2 sqls bellow should be executed right.
    
    
    ## How was this patch tested?
    Updated test cases to reflect the changes.
    


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

    $ git pull https://github.com/watermen/spark SPARK-15549

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

    https://github.com/apache/spark/pull/13321.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 #13321
    
----

----


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