GitHub user cloud-fan opened a pull request:

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

    [SPARK-19305][SQL] partitioned table should always put partition columns at 
the end of table schema

    ## What changes were proposed in this pull request?
    
    For data source tables, we will always reorder the specified table schema, 
or the query in CTAS, to put partition columns at the end. e.g. `CREATE TABLE 
t(a int, b int, c int, d int) USING parquet PARTITIONED BY (d, b)` will create 
a table with schema `<a, c, d, b>`
    
    Hive serde tables don't have this problem before, because its CREATE TABLE 
syntax specifies data schema and partition schema individually.
    
    However, after we unifed the CREATE TABLE syntax, Hive serde table also 
need to do the reorder. This PR puts the reorder logic in a analyzer rule,  
which works with both data source tables and Hive serde tables.
    
    ## How was this patch tested?
    
    new regression test

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

    $ git pull https://github.com/cloud-fan/spark schema

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

    https://github.com/apache/spark/pull/16655.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 #16655
    
----
commit 9ec7d36a198560441e3c3e96fa59789bdd36751b
Author: Wenchen Fan <wenc...@databricks.com>
Date:   2017-01-20T06:10:36Z

    partitioned table should always put partition columns at the end of table 
schema

----


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