@Override
  public int getMaxPrecision(SqlTypeName typeName) {
    switch (typeName) {
      case VARCHAR:
      case CHAR:
      case VARBINARY:
      case BINARY:
        return Integer.MAX_VALUE;

      case TIMESTAMP:
        // The maximum precision of TIMESTAMP is 3 in Calcite,
        // change it to 9 to support nanoseconds precision
        return TimestampType.MAX_PRECISION;

      case TIMESTAMP_WITH_LOCAL_TIME_ZONE:
        // The maximum precision of TIMESTAMP_WITH_LOCAL_TIME_ZONE is 3 in Calcite,
        // change it to 9 to support nanoseconds precision
        return LocalZonedTimestampType.MAX_PRECISION;
    }
    return super.getMaxPrecision(typeName);
  }
Custom type system for Flink.

<p>Copied from flink-1.18.
amoro-format-mixed/amoro-mixed-flink/amoro-mixed-flink-common/src/main/java/org/apache/amoro/flink/planner/calcite/FlinkTypeSystem.java