voonhous commented on code in PR #19338:
URL: https://github.com/apache/hudi/pull/19338#discussion_r3643772805
##########
hudi-common/src/main/java/org/apache/hudi/common/table/timeline/versioning/v1/CompletionTimeQueryViewV1.java:
##########
@@ -205,7 +216,39 @@ private List<String> getInstantTimes(
Option<String> rangeEnd,
InstantRange.RangeType rangeType,
Function<String, String> earliestInstantTimeFunc) {
- throw new RuntimeException("Incremental query view for timeline version 1
not yet implemented");
+ final boolean startFromEarliest =
START_COMMIT_EARLIEST.equalsIgnoreCase(rangeStart.orElse(null));
+ HoodieTimeline completedTimeline = timeline.filterCompletedInstants();
+
+ if (rangeStart.isEmpty() && rangeEnd.isPresent()) {
+ // (_, end]: returns the last instant whose requested time is at or
before 'end'.
+ return completedTimeline.getInstantsAsStream()
+ .filter(instant ->
InstantComparison.compareTimestamps(instant.requestedTime(),
LESSER_THAN_OR_EQUALS, rangeEnd.get()))
+ .max(Comparator.comparing(HoodieInstant::requestedTime))
+ .map(instant -> Collections.singletonList(instant.requestedTime()))
+ .orElse(Collections.emptyList());
+ }
+
+ if (startFromEarliest) {
+ // ['earliest', _): clear the start so it degenerates to consuming from
the earliest instant.
+ rangeStart = Option.empty();
+ }
+
+ if (rangeStart.isEmpty() && rangeEnd.isEmpty()) {
Review Comment:
+1
--
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]