danny0405 commented on code in PR #10284:
URL: https://github.com/apache/hudi/pull/10284#discussion_r1421227164


##########
hudi-common/src/main/java/org/apache/hudi/common/table/timeline/HoodieDefaultTimeline.java:
##########
@@ -420,7 +424,7 @@ public Option<HoodieInstant> nthFromLastInstant(int n) {
 
   @Override
   public boolean containsInstant(HoodieInstant instant) {
-    return getInstantsAsStream().anyMatch(s -> s.equals(instant));
+    return getOrCreateInstantSet().contains(instant);

Review Comment:
   Oops, you should fix this method instead:
   
   ```java
   @Override
     public boolean containsInstant(String ts) {
       // Check for 0.10.0+ timestamps which have msec granularity
       if (getOrCreateInstantSet().contains(ts)) {
         return true;
       }
   
       // Check for older timestamp which have sec granularity and an extension 
of DEFAULT_MILLIS_EXT may have been added via Timeline operations
       if (ts.length() == 
HoodieInstantTimeGenerator.MILLIS_INSTANT_TIMESTAMP_FORMAT_LENGTH && 
ts.endsWith(HoodieInstantTimeGenerator.DEFAULT_MILLIS_EXT)) {
         final String actualOlderFormatTs = ts.substring(0, ts.length() - 
HoodieInstantTimeGenerator.DEFAULT_MILLIS_EXT.length());
         return containsInstant(actualOlderFormatTs);
       }
   
       return false;
     }
   ```



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