GitHub user maropu opened a pull request:
https://github.com/apache/spark/pull/18356
[SPARK-21144][SQL][BRANCH-2.2] Check column name duplication in read/write
paths
## What changes were proposed in this pull request?
This pr fixed 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 name duplication when reading from/writing
to files. This comes from #17758 to fix this issue for v2.2.
## How was this patch tested?
Created a new test suite `SchemaUtilsSuite` and added tests in existing
suites: `DataFrameSuite`, `DDLSuite`, `JDBCWriteSuite`,
`DataFrameReaderWriterSuite`, `HiveMetastoreCatalog`, and `HiveDDLSuite`.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/maropu/spark SPARK-21144-2
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/18356.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 #18356
----
commit 32f0130714f41bc8e0d10b5f309905734274415a
Author: Takeshi Yamamuro <[email protected]>
Date: 2017-04-25T05:24:48Z
Add code to check column name duplication
----
---
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]