yihua commented on code in PR #20273:
URL: https://github.com/apache/hudi/pull/20273#discussion_r4266829192


##########
hudi-common/src/main/java/org/apache/hudi/common/table/read/IncrementalQueryAnalyzer.java:
##########
@@ -188,10 +188,12 @@ public QueryContext analyze() {
         }
       }
       if (!archivedInstantTimes.isEmpty()) {
-        archivedReadTimeline = getArchivedReadTimeline(metaClient, 
archivedInstantTimes.get(0));
+        archivedReadTimeline = getArchivedReadTimeline(metaClient, 
archivedInstantTimes.stream().min(String::compareTo).get());
         archivedInstants = 
archivedReadTimeline.getInstantsAsStream().filter(instant -> 
instantTimeSet.contains(instant.requestedTime())).collect(Collectors.toList());
       }
-      List<String> instants = Stream.concat(archivedInstants.stream(), 
activeInstants.stream()).map(HoodieInstant::requestedTime).collect(Collectors.toList());
+      // archived and active instants can interleave (see 
#splitInstantByActiveness), so order them by instant time.
+      List<String> instants = Stream.concat(archivedInstants.stream(), 
activeInstants.stream()).map(HoodieInstant::requestedTime)
+          .sorted().collect(Collectors.toList());

Review Comment:
   Note that this issue is relevant only when the archival beyond savepoint is 
enabled and there are "holes" in the active timeline, i.e., some commits having 
instant times between the savepoint and later commits are archived.  So this 
does not affect out-of-the-box use cases where the archival beyond savepoint is 
disabled.



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