hudi-agent commented on code in PR #18639:
URL: https://github.com/apache/hudi/pull/18639#discussion_r3376867735


##########
hudi-common/src/main/java/org/apache/hudi/BaseHoodieTableFileIndex.java:
##########
@@ -326,7 +331,11 @@ private Map<PartitionPath, List<FileSlice>> 
generatePartitionFileSlicesPostROTab
       // Add the FileSlice to partitionToFileSlices
       PartitionPath partitionPathObj = partitionsMap.get(relPartitionPath);
       if (partitionPathObj != null) {
-        List<FileSlice> fileSlices = 
partitionToFileSlices.computeIfAbsent(partitionPathObj, k -> new ArrayList<>());
+        List<FileSlice> fileSlices = 
partitionToFileSlices.get(partitionPathObj);
+        if (fileSlices.isEmpty()) {

Review Comment:
   🤖 nit: using `isEmpty()` as the guard is a bit subtle — it works only 
because `Collections.emptyList()` is always empty, but a reader unfamiliar with 
the pre-population above might wonder what happens with a legitimately empty 
mutable list. Could you consider pre-populating with `new ArrayList<>()` 
instead and restoring the original `computeIfAbsent` one-liner? That makes it 
self-evident the slot is always safe to add into.
   
   <sub><i>- AI-generated; verify before applying. React 👍/👎 to flag 
quality.</i></sub>



-- 
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]

Reply via email to