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/24 00:45:39 UTC
[GitHub] [spark] ocworld opened a new pull request, #37262: [SPARK-38102][CORE] Support custom commitProtocolClass in saveAsNewAPIHadoopDataset
ocworld opened a new pull request, #37262:
URL: https://github.com/apache/spark/pull/37262
### What changes were proposed in this pull request?
This is a follow-up PR to [[SPARK-38102](https://issues.apache.org/jira/browse/SPARK-38102)]
It is needed to support custom commitProtocolClass class when using saveAsNewAPIHadoopDataset by an option. For example,
spark.hadoop.mapreduce.sources.commitProtocolClass org.apache.spark.internal.io.cloud.PathOutputCommitProtocol
### Why are the changes needed?
There is no way to apply spark-hadoop-cloud's commitProtocolClass when using saveAsNewAPIHadoopDataset that are to avoid object storage's problem.
https://spark.apache.org/docs/latest/cloud-integration.html
### Does this PR introduce _any_ user-facing change?
Yes. The option is added that is spark.hadoop.mapreduce.sources.commitProtocolClass
### How was this patch tested?
1. Adding unittest
2. Tested in my cluster
--
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
[GitHub] [spark] dongjoon-hyun commented on a diff in pull request #37262: [SPARK-38102][CORE] Support custom commitProtocolClass in saveAsNewAPIHadoopDataset
Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on code in PR #37262:
URL: https://github.com/apache/spark/pull/37262#discussion_r928184360
##########
core/src/test/scala/org/apache/spark/FileSuite.scala:
##########
@@ -485,6 +486,23 @@ class FileSuite extends SparkFunSuite with LocalSparkContext {
assert(new File(tempDir.getPath + "/outputDataset_new/part-r-00000").exists())
}
+ test ("SPARK-38102: save Hadoop Dataset through new Hadoop API with commitProtocolClass option") {
+ sc = new SparkContext("local", "test")
+ val randomRDD = sc.parallelize(
+ Seq(("key1", "a"), ("key2", "a"), ("key3", "b"), ("key4", "c")), 1)
+ val job = Job.getInstance(sc.hadoopConfiguration)
+ job.setOutputKeyClass(classOf[String])
+ job.setOutputValueClass(classOf[String])
+ job.setOutputFormatClass(classOf[NewTextOutputFormat[String, String]])
+ val jobConfig = job.getConfiguration
+ jobConfig.set("mapreduce.output.fileoutputformat.outputdir",
+ tempDir.getPath + "/outputDataset_new")
+ jobConfig.set("mapreduce.sources.commitProtocolClass",
+ classOf[HadoopMapReduceCommitProtocol].getName)
Review Comment:
Does this test case fail without your patch? If not, this is invalid.
--
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
[GitHub] [spark] AmplabJenkins commented on pull request #37262: [SPARK-38102][CORE] Support custom commitProtocolClass in saveAsNewAPIHadoopDataset
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on PR #37262:
URL: https://github.com/apache/spark/pull/37262#issuecomment-1193581347
Can one of the admins verify this patch?
--
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
[GitHub] [spark] HyukjinKwon commented on a diff in pull request #37262: [SPARK-38102][CORE] Support custom commitProtocolClass in saveAsNewAPIHadoopDataset
Posted by GitBox <gi...@apache.org>.
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
[GitHub] [spark] HyukjinKwon commented on a diff in pull request #37262: [SPARK-38102][CORE] Support custom commitProtocolClass in saveAsNewAPIHadoopDataset
Posted by GitBox <gi...@apache.org>.
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 (in your application or project):
```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
[GitHub] [spark] ocworld commented on a diff in pull request #37262: [SPARK-38102][CORE] Support custom commitProtocolClass in saveAsNewAPIHadoopDataset
Posted by GitBox <gi...@apache.org>.
ocworld commented on code in PR #37262:
URL: https://github.com/apache/spark/pull/37262#discussion_r928781731
##########
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:
> The problem here is that we're super conservative in RDD and core API now, and won't likely add something new except bug fixes.
Okay. I understand about it. Thank you for your comment. I will try to your suggested way. Fortunately, I am using scala.
--
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
[GitHub] [spark] HyukjinKwon commented on a diff in pull request #37262: [SPARK-38102][CORE] Support custom commitProtocolClass in saveAsNewAPIHadoopDataset
Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on code in PR #37262:
URL: https://github.com/apache/spark/pull/37262#discussion_r928379349
##########
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:
The problem here is that we're super conservative in RDD and core API now, and won't likely add something new except bug fixes.
--
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
[GitHub] [spark] ocworld closed pull request #37262: [SPARK-38102][CORE] Support custom commitProtocolClass in saveAsNewAPIHadoopDataset
Posted by GitBox <gi...@apache.org>.
ocworld closed pull request #37262: [SPARK-38102][CORE] Support custom commitProtocolClass in saveAsNewAPIHadoopDataset
URL: https://github.com/apache/spark/pull/37262
--
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