WinkerDu commented on a change in pull request #29000:
URL: https://github.com/apache/spark/pull/29000#discussion_r464105285



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/SQLHadoopMapReduceCommitProtocol.scala
##########
@@ -55,7 +55,8 @@ class SQLHadoopMapReduceCommitProtocol(
         // The specified output committer is a FileOutputCommitter.
         // So, we will use the FileOutputCommitter-specified constructor.
         val ctor = clazz.getDeclaredConstructor(classOf[Path], 
classOf[TaskAttemptContext])
-        committer = ctor.newInstance(new Path(path), context)
+        val committerOutputPath = if (dynamicPartitionOverwrite) stagingDir 
else new Path(path)
+        committer = ctor.newInstance(committerOutputPath, context)

Review comment:
       In my opinion, it is not the same. Since for  ` 
SQLHadoopMapReduceCommitProtocol` which derived from 
`HadoopMapReduceCommitProtocol`, final output path for 
`dynamicPartitionOverwrite` job is the same as other kind of job, there are 2 
steps during job committing:
   1. move task committed directories to 
`/path/to/output/.spark-staging-{jobId}`, the code here inits a committer with 
output path `/path/to/output/.spark-staging-{jobId}`
   2. move partition directories under `/path/to/output/.spark-staging-{jobId}` 
to final output path




----------------------------------------------------------------
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.

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