-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-20594][SQL]The staging directory should be a child directory starts with "." to avoid being deleted if we set hive.exec.stagingdir under the table directory. #17858
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c154f3a
[SPARK-20594]The staging directory should be appended with ".hive-sta…
de938ed
add a test case for SPARK-20594
6b22d3e
[SPARK-20594]The staging directory should be a child directory starts…
6b1b153
should add stripPrefix(File.separator)
2a542e4
Fix scala style checks
9f41436
Fix code review
bf1b4ec
Fix code review
4e1b6a0
Fix test case
639d63a
simplify the test case
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -494,4 +494,34 @@ class InsertIntoHiveTableSuite extends QueryTest with TestHiveSingleton with Bef | |
| spark.table("t").write.insertInto(tableName) | ||
| } | ||
| } | ||
|
|
||
| test( | ||
| """SPARK-20594: This is a walk-around fix to resolve a Hive bug. Hive requires that the | ||
| |staging directory needs to avoid being deleted when users set hive.exec.stagingdir | ||
| |under the table directory.""".stripMargin) { | ||
|
|
||
| withTable("test_table") { | ||
| spark.range(1).write.saveAsTable("test_table") | ||
|
|
||
| // Make sure the table has also been updated. | ||
| checkAnswer( | ||
| sql("SELECT * FROM test_table"), | ||
| Row(0) | ||
| ) | ||
|
|
||
| // Set hive.exec.stagingdir under the table directory without start with ".". | ||
| sql("set hive.exec.stagingdir=./test") | ||
|
||
|
|
||
| // Now overwrite. | ||
| sql("INSERT OVERWRITE TABLE test_table SELECT 1") | ||
|
|
||
| // Make sure the table has also been updated. | ||
| checkAnswer( | ||
| sql("SELECT * FROM test_table"), | ||
| Row(1) | ||
| ) | ||
|
|
||
| sql("reset") | ||
| } | ||
| } | ||
| } | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without your fix, this test case still passes. Could you please check it?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, as i tested again, we must create table rather than simplify by
spark.range(1).write.saveAsTable("test_table"). Thanks again. :)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uh, because that is not to create a Hive table. How about simplifying the test case to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good choice. thanks for your time!