[SPARK-54003][SQL] Use the staging directory as the output path then move to final path. #52720
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?
The key modifications are as follows:
SQLHadoopMapReduceCommitProtocoland perform a rename from the source directory to the destination directory during the commit job phase.Dynamic partition overwriteandcustom partition pathhave also been integrated into this process.Avoid deleting partitions before task runs and implement dynamic overwrite in
SQLHadoopMapReduceCommitProtocol. To maintain compatibility with static mode, the corresponding partition files need to be deleted duringrefreshUpdatedPartitions.Handle paths according to
SaveModeinSQLHadoopMapReduceCommitProtocol.Why are the changes needed?
SparkSQL uses the partition location or table location as the commit path (except in
dynamic partition overwritemode andcustom partition pathmode). This has at least the following issues:Dynamic partition overwritemode andcustom partition pathmode already use the staging directory. Anddynamic partition overwritemode andcustom partition pathare implemented differently, which can be simplified into a unified process. And in #29000, reset the staging directory as the output directory of FileOutputCommitter. This way is more safer. It should be modified to this way.Does this PR introduce any user-facing change?
No
How was this patch tested?
Existing unit tests and newly added unit tests