-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-30112][SQL] Allow insert overwrite same table if using dynamic partition overwrite #26752
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
Conversation
|
cc @cloud-fan |
|
Test build #114806 has finished for PR 26752 at commit
|
e5f4122 to
378fbc4
Compare
|
Test build #114827 has finished for PR 26752 at commit
|
|
retest this please. |
|
Test build #114840 has finished for PR 26752 at commit
|
|
Retest this please. |
|
Thank you for making a PR for this issue. |
|
|
||
| test("it is allowed to write to a table while querying it for dynamic partition overwrite.") { | ||
| Seq(PartitionOverwriteMode.DYNAMIC.toString, | ||
| PartitionOverwriteMode.STATIC.toString).foreach { usedMode => |
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.
usedMode -> mode.
| """ | ||
| |CREATE TABLE insertTable(i int, part1 int, part2 int) USING PARQUET | ||
| |PARTITIONED BY (part1, part2) | ||
| """.stripMargin) |
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.
indentation?
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.
oops! thanks!
| """ | ||
| |INSERT OVERWRITE TABLE insertTable PARTITION(part1=1, part2) | ||
| |SELECT i + 1, part2 FROM insertTable | ||
| """.stripMargin) |
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.
indentation?
|
Test build #114920 has finished for PR 26752 at commit
|
|
Test build #114921 has finished for PR 26752 at commit
|
|
cc @cloud-fan |
|
|
||
| private lazy val parameters = CaseInsensitiveMap(options) | ||
|
|
||
| private[sql] lazy val dynamicPartitionOverwriteEnabled: Boolean = { |
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 just name it dynamicPartitionOverwrite? then we can remove https://github.com/apache/spark/pull/26752/files#diff-f9858c2d9d1a3c3e48753ef675bc865aR109
| "INSERT OVERWRITE to a table while querying it should not be allowed.") | ||
| } | ||
|
|
||
| test("it is allowed to write to a table while querying it for dynamic partition overwrite.") { |
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 put the JIRA id?
dongjoon-hyun
left a comment
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.
+1, LGTM. Merged to master.
Thank you so much, @viirya and @cloud-fan .
I also verified the last commit manually.
|
Test build #114956 has finished for PR 26752 at commit
|
|
thanks! @cloud-fan @dongjoon-hyun |
What changes were proposed in this pull request?
This patch proposes to allow insert overwrite same table if using dynamic partition overwrite.
Why are the changes needed?
Currently, Insert overwrite cannot overwrite to same table even it is dynamic partition overwrite. But for dynamic partition overwrite, we do not delete partition directories ahead. We write to staging directories and move data to final partition directories. We should be able to insert overwrite to same table under dynamic partition overwrite.
This enables users to read data from a table and insert overwrite to same table by using dynamic partition overwrite. Because this is not allowed for now, users need to write to other temporary location and move it back to the table.
Does this PR introduce any user-facing change?
Yes. Users can insert overwrite same table if using dynamic partition overwrite.
How was this patch tested?
Unit test.