danny0405 commented on code in PR #9776:
URL: https://github.com/apache/hudi/pull/9776#discussion_r1349442571
##########
hudi-common/src/main/java/org/apache/hudi/common/table/timeline/CompletionTimeQueryView.java:
##########
@@ -69,6 +84,64 @@ public CompletionTimeQueryView(HoodieTableMetaClient
metaClient, String startIns
load();
}
+ /**
+ * Returns whether the instant is completed.
+ */
+ public boolean isCompleted(String instantTime) {
+ return getCompletionTime(instantTime).isPresent();
+ }
+
+ /**
+ * Returns whether the give instant time {@code instantTime} completed
before the base instant {@code baseInstant}.
+ */
+ public boolean isCompletedBefore(String baseInstant, String instantTime) {
+ Option<String> completionTimeOpt = getCompletionTime(baseInstant,
instantTime);
+ if (completionTimeOpt.isPresent()) {
+ return HoodieTimeline.compareTimestamps(completionTimeOpt.get(),
LESSER_THAN, baseInstant);
+ }
+ return false;
+ }
+
+ /**
+ * Returns whether the give instant time {@code instantTime} is sliced after
or on the base instant {@code baseInstant}.
+ */
+ public boolean isSlicedAfterOrOn(String baseInstant, String instantTime) {
+ Option<String> completionTimeOpt = getCompletionTime(baseInstant,
instantTime);
+ if (completionTimeOpt.isPresent()) {
+ return HoodieTimeline.compareTimestamps(completionTimeOpt.get(),
GREATER_THAN_OR_EQUALS, baseInstant);
+ }
+ return true;
+ }
+
+ /**
+ * Get completion time with a base instant time as a reference to fix the
compatibility.
+ *
+ * @param baseInstant The base instant
+ * @param instantTime The instant time to query the completion time with
+ *
+ * @return Probability fixed completion time.
+ */
+ public Option<String> getCompletionTime(String baseInstant, String
instantTime) {
Review Comment:
We already have tests in `TestHoodieTableFileSystemView`.
--
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]