Uh oh!
There was an error while loading. Please reload this page.
[SPARK-37210][CORE][SQL] Allow forced use of staging directory - #37346
[SPARK-37210][CORE][SQL] Allow forced use of staging directory#37346wForget wants to merge 2 commits into
Conversation
wForget
commented
Jul 30, 2022
Hi @dongjoon-hyun , could you please help me review it? |
AmplabJenkins
commented
Jul 31, 2022
Can one of the admins verify this patch? |
dongjoon-hyun
commented
Aug 1, 2022
viirya
left a comment
There was a problem hiding this comment.
Why it is an issue particular for InsertIntoHadoopFsRelationCommand?
wForget
commented
Aug 2, 2022
InsertIntoHadoopFsRelationCommand only uses spark staging dir in dynamic overwrite mode, otherwise it uses table_location/_temporary which leads to concurrency conflicts. |
viirya
left a comment
There was a problem hiding this comment.
The usecase looks suspicious to me. Is it a valid one? I'm not sure that InsertIntoHadoopFsRelationCommand guarantees concurrent writing to same table.
wForget
commented
Aug 3, 2022
It seems a reasonable requirement to concurrently write to different partitions of the same table. Is there some blocking issues? |
We're closing this PR because it hasn't been updated in a while. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable. |
zhengchenyu
commented
Oct 13, 2025
@viirya@wForget@dongjoon-hyun For any partition application, will delete How about reopen this PR? And I think the use case is not suspicious. For example, if I want to recalculate the partition data for the last month, I will run multiple application in parallel. |
zhengchenyu
commented
Oct 14, 2025
After some research, I discovered that the I believe the issue of running multiple partitions application in parallel is similar to the two above. Could we make writing to |
| new Path(Option(f.getWorkPath).map(_.toString).getOrElse(path)) | ||
| case _ => new Path(path) | ||
| } | ||
| if (forceUseStagingDir && !dynamicPartitionOverwrite) { |
There was a problem hiding this comment.
when spark.sql.hive.convertMetastoreParquet or spark.sql.hive.convertMetastoreOrc is false, mean use hive serde. We also call newTaskTempFileAbsPath. Here will trigger rename. I suspect this is a conflict with hive serde logic.
What changes were proposed in this pull request?
Add
forceUseStagingDirconfig to force use of staging dir when writing.When setting
forceUseStagingDirto true, I setcommitterOutputPathto staging dir inInsertIntoHadoopFsRelationCommandand forHadoopMapReduceCommitProtocol.newTaskTempFilemethod I calculate absolute dir and callnewTaskTempFileAbsPath.Why are the changes needed?
As discussed in SPARK-37210, errors or data loss may occur under some concurrent write scenarios.
Does this PR introduce any user-facing change?
No
How was this patch tested?
Added test case in
InsertSuite.