diqiu50 commented on code in PR #6657:
URL: https://github.com/apache/gravitino/pull/6657#discussion_r2055512039
##########
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;
+
Review Comment:
We can keep these constructors
```
private TimeType() {
this.precision = Optional.empty();
}
private TimeType(int precision) {
this.precision = Optional.of(precision);
}
```
--
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]