shrirangmhalgi opened a new pull request, #56126:
URL: https://github.com/apache/spark/pull/56126

   
   ### What changes were proposed in this pull request?
   Move `committer.setupJob(job)` from inside `writeAndCommit()` to before 
`materializeAdaptiveSparkPlan()` in `FileFormatWriter.write()`.
   
   
   ### Why are the changes needed?
   `INSERT OVERWRITE` deletes the output path before calling `write()`. When 
`materializeAdaptiveSparkPlan` throws (AQE shuffle stage failure), 
`writeAndCommit` is never reached, so `setupJob` never recreates the path. The 
table path is permanently lost.
   
   
   ### Does this PR introduce _any_ user-facing change?
   Yes. Previously, a failed `INSERT OVERWRITE` with AQE could permanently 
delete the table path. Now the path survives the failure.
   
   
   ### How was this patch tested?
   Added regression test in `InsertSuite` that uses a failing UDF in a shuffle 
stage to trigger AQE failure during `materializeAdaptiveSparkPlan`. Verifies 
the table path exists after the failed overwrite.
   
   
   ### Was this patch authored or co-authored using generative AI tooling?
   Yes.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to