GitHub user gatorsmile opened a pull request:
https://github.com/apache/spark/pull/18295
[SPARK-21085] [SQL] Failed to read the partitioned table created by Spark
2.1
### What changes were proposed in this pull request?
Before the PR, Spark is unable to read the partitioned table created by
Spark 2.1 when the table schema does not put the partitioning column at the end
of the schema.
[assert(partitionFields.map(_.name) ==
partitionColumnNames)](https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/interface.scala#L234-L236)
When reading the table metadata from the metastore, we also need to reorder
the columns.
### How was this patch tested?
Added test cases to check both Hive-serde and data source tables.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/gatorsmile/spark reorderReadSchema
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/18295.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 #18295
----
commit 719ecf2149502ff301f259cc13e916dfd5547629
Author: gatorsmile <[email protected]>
Date: 2017-06-14T05:17:24Z
fix.
----
---
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]