c21 commented on a change in pull request #32198: URL: https://github.com/apache/spark/pull/32198#discussion_r617889174
########## File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/FileFormatWriter.scala ########## @@ -273,14 +289,25 @@ object FileFormatWriter extends Logging { } else if (description.partitionColumns.isEmpty && description.bucketIdExpression.isEmpty) { new SingleDirectoryDataWriter(description, taskAttemptContext, committer) } else { - new DynamicPartitionDataWriter(description, taskAttemptContext, committer) + concurrentOutputWriterSpec match { + case Some(spec) => + new DynamicPartitionDataConcurrentWriter( + description, taskAttemptContext, committer, spec) + case _ => + new DynamicPartitionDataSingleWriter(description, taskAttemptContext, committer) + } } try { Utils.tryWithSafeFinallyAndFailureCallbacks(block = { // Execute the task to write rows out and commit the task. - while (iterator.hasNext) { - dataWriter.write(iterator.next()) + dataWriter match { + case w: DynamicPartitionDataConcurrentWriter => + w.writeWithIterator(iterator) Review comment: @cloud-fan - ~wondering what's the benefit of doing it? Updated anyway now~. After a second thought I think I get it. You want to avoid the pattern matching here, updated. -- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org