GitHub user maropu opened a pull request:
https://github.com/apache/spark/pull/18375
[SPARK-21144][SQL] Check if the data schema and partition schema have the
duplicate columns
## What changes were proposed in this pull request?
The current master outputs unexpected results when the data schema and
partition schema have the duplicate columns:
```
withTempPath { dir =>
val basePath = dir.getCanonicalPath
spark.range(0, 3).toDF("foo").write.parquet(new Path(basePath,
"foo=1").toString)
spark.range(0, 3).toDF("foo").write.parquet(new Path(basePath,
"foo=a").toString)
spark.read.parquet(basePath).show()
}
+---+
|foo|
+---+
| 1|
| 1|
| a|
| a|
| 1|
| a|
+---+
```
This patch added code to check the duplication in `DataSource`.
## How was this patch tested?
Added tests in `DataFrameReaderWriterSuite`.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/maropu/spark SPARK-21144-3
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/18375.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 #18375
----
commit c6cd4943e8fc025cb1422a1ffe8baaf112b2dfbb
Author: Takeshi Yamamuro <[email protected]>
Date: 2017-06-21T10:08:38Z
Fails when the data schema and partition schema have the duplicate columns
commit d5c7d081efaeda737cd079063872a2c9a97bd071
Author: Takeshi Yamamuro <[email protected]>
Date: 2017-06-21T10:33:04Z
[WIP] Need to modify existing tests?
----
---
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]