jshmchenxi commented on a change in pull request #2800:
URL: https://github.com/apache/iceberg/pull/2800#discussion_r667412218
##########
File path: spark2/src/main/java/org/apache/iceberg/spark/source/Reader.java
##########
@@ -206,11 +219,17 @@ public StructType readSchema() {
Broadcast<Table> tableBroadcast =
sparkContext.broadcast(SerializableTable.copyOf(table));
List<InputPartition<ColumnarBatch>> readTasks = Lists.newArrayList();
- for (CombinedScanTask task : tasks()) {
- readTasks.add(new ReadTask<>(
- task, tableBroadcast, expectedSchemaString, caseSensitive,
- localityPreferred, new BatchReaderFactory(batchSize)));
- }
+ Tasks.foreach(tasks())
+ .stopOnFailure()
+ .executeWith(readTasksInitExecutorService)
+ .run(task -> {
+ InputPartition<ColumnarBatch> readTask = new ReadTask<>(
+ task, tableBroadcast, expectedSchemaString, caseSensitive,
+ localityPreferred, new BatchReaderFactory(batchSize));
+ synchronized (readTasks) {
Review comment:
At first time I wanted to use a concurrent list. But this would change
the return value from a normal list to a concurrent list, and the subsequent
operation on this list should only be read. Maybe it will affect performance.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]