Github user mridulm commented on a diff in the pull request: https://github.com/apache/spark/pull/16204#discussion_r91506820 --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/FileFormatWriter.scala --- @@ -225,32 +228,46 @@ object FileFormatWriter extends Logging { taskAttemptContext: TaskAttemptContext, committer: FileCommitProtocol) extends ExecuteWriteTask { - private[this] var outputWriter: OutputWriter = { + private[this] var currentWriter: OutputWriter = _ + + private def newOutputWriter(fileCounter: Int): Unit = { + val ext = description.outputWriterFactory.getFileExtension(taskAttemptContext) val tmpFilePath = committer.newTaskTempFile( taskAttemptContext, None, - description.outputWriterFactory.getFileExtension(taskAttemptContext)) + f"-c$fileCounter%03d" + ext) - val outputWriter = description.outputWriterFactory.newInstance( + currentWriter = description.outputWriterFactory.newInstance( path = tmpFilePath, dataSchema = description.nonPartitionColumns.toStructType, context = taskAttemptContext) - outputWriter.initConverter(dataSchema = description.nonPartitionColumns.toStructType) - outputWriter + currentWriter.initConverter(dataSchema = description.nonPartitionColumns.toStructType) } override def execute(iter: Iterator[InternalRow]): Set[String] = { + var fileCounter = 0 + var recordsInFile = 0 --- End diff -- long ?
--- 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