Github user HyukjinKwon commented on a diff in the pull request: https://github.com/apache/spark/pull/16098#discussion_r90643022 --- Diff: core/src/main/scala/org/apache/spark/internal/io/SparkHadoopMapReduceWriter.scala --- @@ -146,29 +146,32 @@ object SparkHadoopMapReduceWriter extends Logging { case c: Configurable => c.setConf(hadoopConf) case _ => () } - val writer = taskFormat.getRecordWriter(taskContext) - .asInstanceOf[RecordWriter[K, V]] - require(writer != null, "Unable to obtain RecordWriter") var recordsWritten = 0L // Write all rows in RDD partition. try { val ret = Utils.tryWithSafeFinallyAndFailureCallbacks { - while (iterator.hasNext) { - val pair = iterator.next() - writer.write(pair._1, pair._2) - - // Update bytes written metric every few records - SparkHadoopWriterUtils.maybeUpdateOutputMetrics( - outputMetricsAndBytesWrittenCallback, recordsWritten) - recordsWritten += 1 + val writer = taskFormat.getRecordWriter(taskContext) --- End diff -- I was a bit worried of moving this in here because we now abort the task when it fails to create a record reader. Just to convince myself, I at least checked `FileSystem.create(..)` is called within `TextOutputFormat.getRecordWriter` and it seems removed via `FileOutputCommitter.abortTask(..)`.
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org