diqiu50 commented on code in PR #6657: URL: https://github.com/apache/gravitino/pull/6657#discussion_r1992563780
########## 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: There are two problems: 1. Is mysql support timestamp(9)? 2. The error message should like "Invalid mysql timestamp 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: commits-unsubscr...@gravitino.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org