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


##########
flink-connector/flink/src/main/java/org/apache/gravitino/flink/connector/utils/TypeUtils.java:
##########
@@ -36,6 +36,14 @@
 
 public class TypeUtils {
 
+  // Flink supports time/timestamp precision from 0 to 9 (nanosecond 
precision).
+  // @see
+  // 
https://nightlies.apache.org/flink/flink-docs-release-2.1/docs/dev/table/types/#date-and-time
+  protected static final int FLINK_SECONDS_PRECISION = 0;
+  protected static final int FLINK_MILLIS_PRECISION = 3;

Review Comment:
   I don't see the usage of `FLINK_MILLIS_PRECISION`



##########
trino-connector/trino-connector/src/main/java/org/apache/gravitino/trino/connector/catalog/iceberg/IcebergDataTypeTransformer.java:
##########
@@ -59,14 +59,50 @@ public io.trino.spi.type.Type getTrinoType(Type type) {
     if (Name.FIXED == type.name()) {
       return VarbinaryType.VARBINARY;
     } else if (Name.TIME == type.name()) {
+      Types.TimeType timeType = (Types.TimeType) type;
+      if (timeType.hasPrecisionSet()) {
+        int precision = timeType.precision();
+        if (precision == TRINO_SECONDS_PRECISION) {
+          return TimeType.TIME_SECONDS;
+        } else if (precision <= TRINO_MILLIS_PRECISION) {
+          return TimeType.TIME_MILLIS;
+        } else if (precision <= TRINO_MICROS_PRECISION) {
+          return TimeType.TIME_MICROS;

Review Comment:
   why don't you use `TimeType.createTimeType(precision)` to use the 
corresponding 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]

Reply via email to