Uh oh!
There was an error while loading. Please reload this page.
[SPARK-25389][SQL] INSERT OVERWRITE DIRECTORY STORED AS should prevent duplicate fields - #22378
Closed
dongjoon-hyun wants to merge 1 commit into
Closed
[SPARK-25389][SQL] INSERT OVERWRITE DIRECTORY STORED AS should prevent duplicate fields#22378dongjoon-hyun wants to merge 1 commit into
dongjoon-hyun wants to merge 1 commit into
Conversation
SparkQA
commented
Sep 10, 2018
Test build #95860 has finished for PR 22378 at commit
|
HyukjinKwon
commented
Sep 10, 2018
Member
retest this please |
SparkQA
commented
Sep 10, 2018
Test build #95865 has finished for PR 22378 at commit
|
dongjoon-hyun
commented
Sep 10, 2018
MemberAuthor
Retest this please. |
SparkQA
commented
Sep 10, 2018
Test build #95879 has finished for PR 22378 at commit
|
dongjoon-hyun
commented
Sep 10, 2018
MemberAuthor
Retest this please. |
SparkQA
commented
Sep 10, 2018
Test build #95891 has finished for PR 22378 at commit
|
dongjoon-hyun
commented
Sep 10, 2018
MemberAuthor
Could you review this, @gatorsmile , @cloud-fan , and @seancxmao ? |
| s""" | ||
| |INSERT OVERWRITE $local DIRECTORY '${dir.toURI}' | ||
| |STORED AS $format | ||
| |SELECT 'id', 'id2' ${if (caseSensitivity) "id" else "ID"} |
Contributor
There was a problem hiding this comment.
do we miss a comma after 'id2'?
MemberAuthor
There was a problem hiding this comment.
id2 is value and the following one appends alias; id or ID.
cloud-fan
commented
Sep 11, 2018
Contributor
LGTM |
HyukjinKwon
approved these changes
Sep 11, 2018
dongjoon-hyun
commented
Sep 11, 2018
MemberAuthor
Thank you for review, @cloud-fan and @HyukjinKwon . |
dongjoon-hyun
commented
Sep 11, 2018
MemberAuthor
Merged to master/2.4. |
asfgit pushed a commit
that referenced
this pull request
Sep 11, 2018
…t duplicate fields
## What changes were proposed in this pull request?
Like `INSERT OVERWRITE DIRECTORY USING` syntax, `INSERT OVERWRITE DIRECTORY STORED AS` should not generate files with duplicate fields because Spark cannot read those files back.
**INSERT OVERWRITE DIRECTORY USING**
```scala
scala> sql("INSERT OVERWRITE DIRECTORY 'file:///tmp/parquet' USING parquet SELECT 'id', 'id2' id")
... ERROR InsertIntoDataSourceDirCommand: Failed to write to directory ...
org.apache.spark.sql.AnalysisException: Found duplicate column(s) when inserting into file:/tmp/parquet: `id`;
```
**INSERT OVERWRITE DIRECTORY STORED AS**
```scala
scala> sql("INSERT OVERWRITE DIRECTORY 'file:///tmp/parquet' STORED AS parquet SELECT 'id', 'id2' id")
// It generates corrupted files
scala> spark.read.parquet("/tmp/parquet").show
18/09/09 22:09:57 WARN DataSource: Found duplicate column(s) in the data schema and the partition schema: `id`;
```
## How was this patch tested?
Pass the Jenkins with newly added test cases.
Closes#22378 from dongjoon-hyun/SPARK-25389.
Authored-by: Dongjoon Hyun <dongjoon@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit 77579aa)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>fjh100456 pushed a commit
to fjh100456/spark
that referenced
this pull request
Sep 13, 2018
…t duplicate fields
## What changes were proposed in this pull request?
Like `INSERT OVERWRITE DIRECTORY USING` syntax, `INSERT OVERWRITE DIRECTORY STORED AS` should not generate files with duplicate fields because Spark cannot read those files back.
**INSERT OVERWRITE DIRECTORY USING**
```scala
scala> sql("INSERT OVERWRITE DIRECTORY 'file:///tmp/parquet' USING parquet SELECT 'id', 'id2' id")
... ERROR InsertIntoDataSourceDirCommand: Failed to write to directory ...
org.apache.spark.sql.AnalysisException: Found duplicate column(s) when inserting into file:/tmp/parquet: `id`;
```
**INSERT OVERWRITE DIRECTORY STORED AS**
```scala
scala> sql("INSERT OVERWRITE DIRECTORY 'file:///tmp/parquet' STORED AS parquet SELECT 'id', 'id2' id")
// It generates corrupted files
scala> spark.read.parquet("/tmp/parquet").show
18/09/09 22:09:57 WARN DataSource: Found duplicate column(s) in the data schema and the partition schema: `id`;
```
## How was this patch tested?
Pass the Jenkins with newly added test cases.
Closesapache#22378 from dongjoon-hyun/SPARK-25389.
Authored-by: Dongjoon Hyun <dongjoon@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Like
INSERT OVERWRITE DIRECTORY USINGsyntax,INSERT OVERWRITE DIRECTORY STORED ASshould not generate files with duplicate fields because Spark cannot read those files back.INSERT OVERWRITE DIRECTORY USING
INSERT OVERWRITE DIRECTORY STORED AS
How was this patch tested?
Pass the Jenkins with newly added test cases.