Skip to content
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

[SPARK-37217][SQL][3.2] The number of dynamic partitions should early check when writing to external tables #34889

Closed
wants to merge 1 commit into from

Conversation

cxzl25
Copy link
Contributor

@cxzl25 cxzl25 commented Dec 14, 2021

What changes were proposed in this pull request?

SPARK-29295 introduces a mechanism that writes to external tables is a dynamic partition method, and the data in the target partition will be deleted first.

Assuming that 1001 partitions are written, the data of 10001 partitions will be deleted first, but because hive.exec.max.dynamic.partitions is 1000 by default, loadDynamicPartitions will fail at this time, but the data of 1001 partitions has been deleted.

So we can check whether the number of dynamic partitions is greater than hive.exec.max.dynamic.partitions before deleting, it should fail quickly at this time.

Why are the changes needed?

Avoid data that cannot be recovered when the job fails.

Does this PR introduce any user-facing change?

No

How was this patch tested?

add UT

…k when writing to external tables

### What changes were proposed in this pull request?
SPARK-29295 introduces a mechanism that writes to external tables is a dynamic partition method, and the data in the target partition will be deleted first.

Assuming that 1001 partitions are written, the data of 10001 partitions will be deleted first, but because `hive.exec.max.dynamic.partitions` is 1000 by default, loadDynamicPartitions will fail at this time, but the data of 1001 partitions has been deleted.

So we can check whether the number of dynamic partitions is greater than `hive.exec.max.dynamic.partitions` before deleting, it should fail quickly at this time.

### Why are the changes needed?
Avoid data that cannot be recovered when the job fails.

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
add UT

Closes apache#34493 from cxzl25/SPARK-37217.

Authored-by: sychen <sychen@ctrip.com>
Signed-off-by: Chao Sun <sunchao@apple.com>

(cherry picked from commit 4b849ef)
@AmplabJenkins
Copy link

Can one of the admins verify this patch?

Copy link
Member

@sunchao sunchao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

sunchao pushed a commit that referenced this pull request Dec 14, 2021
… check when writing to external tables

### What changes were proposed in this pull request?
SPARK-29295 introduces a mechanism that writes to external tables is a dynamic partition method, and the data in the target partition will be deleted first.

Assuming that 1001 partitions are written, the data of 10001 partitions will be deleted first, but because `hive.exec.max.dynamic.partitions` is 1000 by default, loadDynamicPartitions will fail at this time, but the data of 1001 partitions has been deleted.

So we can check whether the number of dynamic partitions is greater than `hive.exec.max.dynamic.partitions` before deleting, it should fail quickly at this time.

### Why are the changes needed?
Avoid data that cannot be recovered when the job fails.

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
add UT

Closes #34889 from cxzl25/SPARK-37217-3.2.

Authored-by: sychen <sychen@ctrip.com>
Signed-off-by: Chao Sun <sunchao@apple.com>
@sunchao
Copy link
Member

sunchao commented Dec 14, 2021

Merged to branch-3.2. Thanks!

@sunchao sunchao closed this Dec 14, 2021
catalinii pushed a commit to lyft/spark that referenced this pull request Feb 22, 2022
… check when writing to external tables

### What changes were proposed in this pull request?
SPARK-29295 introduces a mechanism that writes to external tables is a dynamic partition method, and the data in the target partition will be deleted first.

Assuming that 1001 partitions are written, the data of 10001 partitions will be deleted first, but because `hive.exec.max.dynamic.partitions` is 1000 by default, loadDynamicPartitions will fail at this time, but the data of 1001 partitions has been deleted.

So we can check whether the number of dynamic partitions is greater than `hive.exec.max.dynamic.partitions` before deleting, it should fail quickly at this time.

### Why are the changes needed?
Avoid data that cannot be recovered when the job fails.

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
add UT

Closes apache#34889 from cxzl25/SPARK-37217-3.2.

Authored-by: sychen <sychen@ctrip.com>
Signed-off-by: Chao Sun <sunchao@apple.com>
catalinii pushed a commit to lyft/spark that referenced this pull request Mar 4, 2022
… check when writing to external tables

### What changes were proposed in this pull request?
SPARK-29295 introduces a mechanism that writes to external tables is a dynamic partition method, and the data in the target partition will be deleted first.

Assuming that 1001 partitions are written, the data of 10001 partitions will be deleted first, but because `hive.exec.max.dynamic.partitions` is 1000 by default, loadDynamicPartitions will fail at this time, but the data of 1001 partitions has been deleted.

So we can check whether the number of dynamic partitions is greater than `hive.exec.max.dynamic.partitions` before deleting, it should fail quickly at this time.

### Why are the changes needed?
Avoid data that cannot be recovered when the job fails.

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
add UT

Closes apache#34889 from cxzl25/SPARK-37217-3.2.

Authored-by: sychen <sychen@ctrip.com>
Signed-off-by: Chao Sun <sunchao@apple.com>
kazuyukitanimura pushed a commit to kazuyukitanimura/spark that referenced this pull request Aug 10, 2022
… check when writing to external tables

### What changes were proposed in this pull request?
SPARK-29295 introduces a mechanism that writes to external tables is a dynamic partition method, and the data in the target partition will be deleted first.

Assuming that 1001 partitions are written, the data of 10001 partitions will be deleted first, but because `hive.exec.max.dynamic.partitions` is 1000 by default, loadDynamicPartitions will fail at this time, but the data of 1001 partitions has been deleted.

So we can check whether the number of dynamic partitions is greater than `hive.exec.max.dynamic.partitions` before deleting, it should fail quickly at this time.

### Why are the changes needed?
Avoid data that cannot be recovered when the job fails.

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
add UT

Closes apache#34889 from cxzl25/SPARK-37217-3.2.

Authored-by: sychen <sychen@ctrip.com>
Signed-off-by: Chao Sun <sunchao@apple.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants