cloud-fan commented on a change in pull request #32198:
URL: https://github.com/apache/spark/pull/32198#discussion_r617343611
##########
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:
We can make it an API in the base class, which by default just do
```
while (iterator.hasNext) {
write(iterator.next())
}
```
--
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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]