deniskuzZ commented on code in PR #5712:
URL: https://github.com/apache/hive/pull/5712#discussion_r2016152736
##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/writer/WriterRegistry.java:
##########
@@ -36,13 +36,10 @@ public static Map<String, List<HiveIcebergWriter>>
removeWriters(TaskAttemptID t
}
public static void registerWriter(TaskAttemptID taskAttemptID, String
tableName, HiveIcebergWriter writer) {
- writers.putIfAbsent(taskAttemptID, Maps.newConcurrentMap());
+ Map<String, List<HiveIcebergWriter>> outputWriters =
+ writers.computeIfAbsent(taskAttemptID, k -> Maps.newConcurrentMap());
- Map<String, List<HiveIcebergWriter>> writersOfTableMap =
writers.get(taskAttemptID);
- writersOfTableMap.putIfAbsent(tableName, Lists.newArrayList());
-
- List<HiveIcebergWriter> writerList = writersOfTableMap.get(tableName);
- writerList.add(writer);
+ outputWriters.computeIfAbsent(tableName, k -> new
CopyOnWriteArrayList<>()).add(writer);
Review Comment:
Writers registration happens during task execution and removal only after
the task commit.
During the task commit, we create the commit manifest file by iterating over
all the registered in the task writers and collecting files produced by them.
The issue is that very rarely, some of the data files aren't added to the
task commit file.
--
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]