-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-18544] [SQL] Append with df.saveAsTable writes data to wrong location #15983
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -188,6 +188,25 @@ class PartitionProviderCompatibilitySuite | |
| } | ||
| } | ||
|
|
||
| for (enabled <- Seq(true, false)) { | ||
| test(s"SPARK-18544 append with saveAsTable - partition management $enabled") { | ||
| withSQLConf(SQLConf.HIVE_MANAGE_FILESOURCE_PARTITIONS.key -> enabled.toString) { | ||
| withTable("test") { | ||
| withTempDir { dir => | ||
| setupPartitionedDatasourceTable("test", dir) | ||
| if (enabled) { | ||
| spark.sql("msck repair table test") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If |
||
| } | ||
| assert(spark.sql("select * from test").count() == 5) | ||
| spark.range(10).selectExpr("id as fieldOne", "id as partCol") | ||
| .write.partitionBy("partCol").mode("append").saveAsTable("test") | ||
| assert(spark.sql("select * from test").count() == 15) | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Runs a test against a multi-level partitioned table, then validates that the custom locations | ||
| * were respected by the output writer. | ||
|
|
||
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.
shall we move this logic to
CreateDataSourceTableAsSelectCommand?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.
nvm, I think it's fine here