Github user liancheng commented on a diff in the pull request:
https://github.com/apache/spark/pull/5042#discussion_r28237317
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/parquet/ParquetTableOperations.scala
---
@@ -403,6 +405,26 @@ private[parquet] class
AppendingParquetOutputFormat(offset: Int)
private def getTaskAttemptID(context: TaskAttemptContext): TaskAttemptID
= {
context.getClass.getMethod("getTaskAttemptID").invoke(context).asInstanceOf[TaskAttemptID]
}
+
+ // override to create output committer from configuration
+ override def getOutputCommitter(context: TaskAttemptContext):
OutputCommitter = {
+ if (committer == null) {
+ val output = getOutputPath(context)
+ val cls =
context.getConfiguration.getClass("spark.sql.parquet.output.committer.class",
+ classOf[ParquetOutputCommitter], classOf[ParquetOutputCommitter])
+ val ctor = cls.getDeclaredConstructor(classOf[Path],
classOf[TaskAttemptContext])
+ committer = ctor.newInstance(output,
context).asInstanceOf[ParquetOutputCommitter]
+ }
+ committer
+ }
+
+ // FileOutputFormat.getOutputPath takes JobConf in hadoop-1 but
JobContext in hadoop-2
+ private def getOutputPath(context: TaskAttemptContext): Path = {
+ context.getConfiguration().get("mapred.output.dir") match {
--- End diff --
Should we check for `mapreduce.output.fileoutputformat.outputdir` instead?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]