xushiyan commented on a change in pull request #4024:
URL: https://github.com/apache/hudi/pull/4024#discussion_r752823452



##########
File path: 
hudi-common/src/main/java/org/apache/hudi/common/table/timeline/HoodieInstantTimeGenerator.java
##########
@@ -33,14 +35,27 @@
  */
 public class HoodieInstantTimeGenerator {
   // Format of the timestamp used for an Instant
-  private static final String INSTANT_TIMESTAMP_FORMAT = "yyyyMMddHHmmss";
-  private static final int INSTANT_TIMESTAMP_FORMAT_LENGTH = 
INSTANT_TIMESTAMP_FORMAT.length();
+  public static final String SECS_INSTANT_TIMESTAMP_FORMAT = "yyyyMMddHHmmss";
+  public static final int SECS_INSTANT_ID_LENGTH = 
SECS_INSTANT_TIMESTAMP_FORMAT.length();
+  public static final String MILLIS_INSTANT_TIMESTAMP_FORMAT = 
"yyyyMMddHHmmssSSS";
+  public static final int MILLIS_INSTANT_ID_LENGTH = 
MILLIS_INSTANT_TIMESTAMP_FORMAT.length();
+  public static final int MILLIS_INSTANT_TIMESTAMP_FORMAT_LENGTH = 
MILLIS_INSTANT_TIMESTAMP_FORMAT.length();
   // Formatter to generate Instant timestamps
-  private static DateTimeFormatter INSTANT_TIME_FORMATTER = 
DateTimeFormatter.ofPattern(INSTANT_TIMESTAMP_FORMAT);
+  // Unfortunately millisecond format is not parsable as is 
https://bugs.openjdk.java.net/browse/JDK-8031085. hence have to do appendValue()
+  private static DateTimeFormatter MILLIS_INSTANT_TIME_FORMATTER = new 
DateTimeFormatterBuilder().appendPattern(SECS_INSTANT_TIMESTAMP_FORMAT)
+      .appendValue(ChronoField.MILLI_OF_SECOND, 3).toFormatter();
+  private static final String MILLIS_GRANULARITY_DATE_FORMAT = "yyyy-MM-dd 
HH:mm:ss:SSS";

Review comment:
       usually sec and millis were separated by `.` instead of `:`
   `yyyy-MM-dd HH:mm:ss.SSS` is a more common format 
   some examples in 
https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html




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