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 registered in the task writers. The issue was that some of 
the data files files weren'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: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to