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


##########
trino-connector/trino-connector/src/main/java/org/apache/gravitino/trino/connector/catalog/jdbc/mysql/MySQLDataTypeTransformer.java:
##########
@@ -55,24 +55,54 @@ public io.trino.spi.type.Type getTrinoType(Type type) {
   }
 
   private static TimestampWithTimeZoneType getTimestampWithTimeZoneType(int 
precision) {
-    if (precision == 0) return TimestampWithTimeZoneType.TIMESTAMP_TZ_SECONDS;
-    if (precision <= 3) return TimestampWithTimeZoneType.TIMESTAMP_TZ_MILLIS;
-    if (precision <= 6) return TimestampWithTimeZoneType.TIMESTAMP_TZ_MICROS;
-    return TimestampWithTimeZoneType.TIMESTAMP_TZ_NANOS;
+    switch (precision) {
+      case 0:
+        return TimestampWithTimeZoneType.TIMESTAMP_TZ_SECONDS;
+      case 3:
+        return TimestampWithTimeZoneType.TIMESTAMP_TZ_MILLIS;
+      case 6:
+        return TimestampWithTimeZoneType.TIMESTAMP_TZ_MICROS;
+      case 9:
+        return TimestampWithTimeZoneType.TIMESTAMP_TZ_NANOS;
+      default:
+        throw new TrinoException(
+            GravitinoErrorCode.GRAVITINO_ILLEGAL_ARGUMENT,
+            "Invalid timestamp precision: " + precision + ". Valid values are 
0, 3, 6, 9");

Review Comment:
   Fine, thx. I'll update later



-- 
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...@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to