mchades commented on code in PR #6657:
URL: https://github.com/apache/gravitino/pull/6657#discussion_r2055493979


##########
api/src/main/java/org/apache/gravitino/rel/types/Types.java:
##########
@@ -330,14 +331,31 @@ public String simpleString() {
 
   /** The time type in Gravitino. */
   public static class TimeType extends Type.DateTimeType {
-    private static final TimeType INSTANCE = new TimeType();
+    private static final TimeType INSTANCE = new TimeType(Optional.empty());
 
     /** @return The singleton instance of {@link TimeType}. */
     public static TimeType get() {
       return INSTANCE;
     }
 
-    private TimeType() {}
+    /**
+     * @param precision The precision of the time type.
+     * @return A {@link TimeType} with the given precision.
+     */
+    public static TimeType of(Integer precision) {
+      return new TimeType(Optional.ofNullable(precision));
+    }
+
+    private final Optional<Integer> precision;
+
+    private TimeType(Optional<Integer> precision) {
+      this.precision = precision;

Review Comment:
   you should check the precision value



##########
api/src/main/java/org/apache/gravitino/rel/types/Types.java:
##########
@@ -330,14 +331,31 @@ public String simpleString() {
 
   /** The time type in Gravitino. */
   public static class TimeType extends Type.DateTimeType {
-    private static final TimeType INSTANCE = new TimeType();
+    private static final TimeType INSTANCE = new TimeType(Optional.empty());

Review Comment:
   since the precision must be positive, I suggest to use a static parameter to 
represent the default precision, WDYT?
   
   ```java
   /** The base type of all date/time types. */
     abstract class DateTimeType extends PrimitiveType {
       /**
        * Indicates that precision for the date/time type was not explicitly 
set by the user. The value
        * should be converted to the catalog's default precision.
        */
       public static final int DATE_TIME_PRECISION_NOT_SET = -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]

Reply via email to