public Type toGravitino()

in catalogs/catalog-jdbc-mysql/src/main/java/org/apache/gravitino/catalog/mysql/converter/MysqlTypeConverter.java [45:97]


  public Type toGravitino(JdbcTypeBean typeBean) {
    switch (typeBean.getTypeName().toLowerCase()) {
      case BIT:
        if (typeBean.getColumnSize() == null || typeBean.getColumnSize() == 1) {
          return Types.BooleanType.get();
        }
        return Types.BinaryType.get();
      case TINYINT:
        return Types.ByteType.get();
      case TINYINT_UNSIGNED:
        return Types.ByteType.unsigned();
      case SMALLINT:
        return Types.ShortType.get();
      case SMALLINT_UNSIGNED:
        return Types.ShortType.unsigned();
      case INT:
        return Types.IntegerType.get();
      case INT_UNSIGNED:
        return Types.IntegerType.unsigned();
      case BIGINT:
        return Types.LongType.get();
      case BIGINT_UNSIGNED:
        return Types.LongType.unsigned();
      case FLOAT:
        return Types.FloatType.get();
      case DOUBLE:
        return Types.DoubleType.get();
      case DATE:
        return Types.DateType.get();
      case TIME:
        return Types.TimeType.get();
        // MySQL converts TIMESTAMP values from the current time zone to UTC for storage, and back
        // from UTC to the current time zone for retrieval. (This does not occur for other types
        // such as DATETIME.) see more details:
        // https://dev.mysql.com/doc/refman/8.0/en/datetime.html
      case TIMESTAMP:
        return Types.TimestampType.withTimeZone();
      case DATETIME:
        return Types.TimestampType.withoutTimeZone();
      case DECIMAL:
        return Types.DecimalType.of(typeBean.getColumnSize(), typeBean.getScale());
      case VARCHAR:
        return Types.VarCharType.of(typeBean.getColumnSize());
      case CHAR:
        return Types.FixedCharType.of(typeBean.getColumnSize());
      case TEXT:
        return Types.StringType.get();
      case BINARY:
        return Types.BinaryType.get();
      default:
        return Types.ExternalType.of(typeBean.getTypeName());
    }
  }