You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/07/25 03:16:35 UTC

[GitHub] [spark] HyukjinKwon commented on a diff in pull request #37262: [SPARK-38102][CORE] Support custom commitProtocolClass in saveAsNewAPIHadoopDataset

HyukjinKwon commented on code in PR #37262:
URL: https://github.com/apache/spark/pull/37262#discussion_r928379125


##########
core/src/main/scala/org/apache/spark/internal/io/SparkHadoopWriter.scala:
##########
@@ -339,7 +339,8 @@ class HadoopMapReduceWriteConfigUtil[K, V: ClassTag](conf: SerializableConfigura
 
   override def createCommitter(jobId: Int): HadoopMapReduceCommitProtocol = {
     FileCommitProtocol.instantiate(
-      className = classOf[HadoopMapReduceCommitProtocol].getName,
+      className = getConf.get("mapreduce.sources.commitProtocolClass",

Review Comment:
   One workaround might be:
   
   ```scala
       val config = new HadoopMapReduceWriteConfigUtil[K, V](new SerializableConfiguration(conf)) {
         override def createCommitter(jobId: Int): HadoopMapReduceCommitProtocol = {
           FileCommitProtocol.instantiate(
             className = "CustomClassName",
             jobId = jobId.toString,
             outputPath = new SerializableConfiguration(
               conf).value.get("mapreduce.output.fileoutputformat.outputdir")
           ).asInstanceOf[HadoopMapReduceCommitProtocol]
         }
       }
       SparkHadoopWriter.write(
         rdd = self,
         config = config)
   ```
   
   Although `HadoopMapReduceWriteConfigUtil` would have to be inherited within `org.apache.spark` package in your project though (if you're using Scala). For Java, it won't validate the package name.



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org