danny0405 commented on code in PR #6000: URL: https://github.com/apache/hudi/pull/6000#discussion_r954643565
########## hudi-common/src/main/java/org/apache/hudi/common/table/timeline/HoodieActiveTimeline.java: ########## @@ -74,16 +74,57 @@ public class HoodieActiveTimeline extends HoodieDefaultTimeline { REQUESTED_REPLACE_COMMIT_EXTENSION, INFLIGHT_REPLACE_COMMIT_EXTENSION, REPLACE_COMMIT_EXTENSION, REQUESTED_INDEX_COMMIT_EXTENSION, INFLIGHT_INDEX_COMMIT_EXTENSION, INDEX_COMMIT_EXTENSION, REQUESTED_SAVE_SCHEMA_ACTION_EXTENSION, INFLIGHT_SAVE_SCHEMA_ACTION_EXTENSION, SAVE_SCHEMA_ACTION_EXTENSION)); + + private static final Set<String> NOT_PARSABLE_TIMESTAMPS = new HashSet<String>(3) {{ + add(HoodieTimeline.INIT_INSTANT_TS); + add(HoodieTimeline.METADATA_BOOTSTRAP_INSTANT_TS); + add(HoodieTimeline.FULL_BOOTSTRAP_INSTANT_TS); + }}; + private static final Logger LOG = LogManager.getLogger(HoodieActiveTimeline.class); protected HoodieTableMetaClient metaClient; /** * Parse the timestamp of an Instant and return a {@code Date}. + * Throw ParseException if timestamp not valid format as + * {@link org.apache.hudi.common.table.timeline.HoodieInstantTimeGenerator#SECS_INSTANT_TIMESTAMP_FORMAT}. Review Comment: `if timestamp not valid` -> `if timestamp is not valid` ########## hudi-common/src/main/java/org/apache/hudi/common/table/timeline/HoodieActiveTimeline.java: ########## @@ -74,16 +74,57 @@ public class HoodieActiveTimeline extends HoodieDefaultTimeline { REQUESTED_REPLACE_COMMIT_EXTENSION, INFLIGHT_REPLACE_COMMIT_EXTENSION, REPLACE_COMMIT_EXTENSION, REQUESTED_INDEX_COMMIT_EXTENSION, INFLIGHT_INDEX_COMMIT_EXTENSION, INDEX_COMMIT_EXTENSION, REQUESTED_SAVE_SCHEMA_ACTION_EXTENSION, INFLIGHT_SAVE_SCHEMA_ACTION_EXTENSION, SAVE_SCHEMA_ACTION_EXTENSION)); + + private static final Set<String> NOT_PARSABLE_TIMESTAMPS = new HashSet<String>(3) {{ + add(HoodieTimeline.INIT_INSTANT_TS); + add(HoodieTimeline.METADATA_BOOTSTRAP_INSTANT_TS); + add(HoodieTimeline.FULL_BOOTSTRAP_INSTANT_TS); + }}; + private static final Logger LOG = LogManager.getLogger(HoodieActiveTimeline.class); protected HoodieTableMetaClient metaClient; /** * Parse the timestamp of an Instant and return a {@code Date}. + * Throw ParseException if timestamp not valid format as + * {@link org.apache.hudi.common.table.timeline.HoodieInstantTimeGenerator#SECS_INSTANT_TIMESTAMP_FORMAT}. + * + * @param timestamp a timestamp String which follow pattern as + * {@link org.apache.hudi.common.table.timeline.HoodieInstantTimeGenerator#SECS_INSTANT_TIMESTAMP_FORMAT}. + * @return Date of instant timestamp */ public static Date parseDateFromInstantTime(String timestamp) throws ParseException { return HoodieInstantTimeGenerator.parseDateFromInstantTime(timestamp); } + /** + * The same format method as above, but this method will mute ParseException. + * If the gaven timestamp is invalid, returns {@code Option.empty}. + * Or a corresponding Date value if these timestamp strings are provided Review Comment: gaven -> given -- 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: commits-unsubscr...@hudi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org