in catalogs/catalog-jdbc-oceanbase/src/main/java/org/apache/gravitino/catalog/oceanbase/converter/OceanBaseTypeConverter.java [94:146]
public String fromGravitino(Type type) {
if (type instanceof Types.ByteType) {
if (((Types.ByteType) type).signed()) {
return TINYINT;
} else {
return TINYINT_UNSIGNED;
}
} else if (type instanceof Types.ShortType) {
if (((Types.ShortType) type).signed()) {
return SMALLINT;
} else {
return SMALLINT_UNSIGNED;
}
} else if (type instanceof Types.IntegerType) {
if (((Types.IntegerType) type).signed()) {
return INT;
} else {
return INT_UNSIGNED;
}
} else if (type instanceof Types.LongType) {
if (((Types.LongType) type).signed()) {
return BIGINT;
} else {
return BIGINT_UNSIGNED;
}
} else if (type instanceof Types.FloatType) {
return type.simpleString();
} else if (type instanceof Types.DoubleType) {
return type.simpleString();
} else if (type instanceof Types.BooleanType) {
return type.simpleString();
} else if (type instanceof Types.StringType) {
return TEXT;
} else if (type instanceof Types.DateType) {
return type.simpleString();
} else if (type instanceof Types.TimeType) {
return type.simpleString();
} else if (type instanceof Types.TimestampType) {
return ((Types.TimestampType) type).hasTimeZone() ? TIMESTAMP : DATETIME;
} else if (type instanceof Types.DecimalType) {
return type.simpleString();
} else if (type instanceof Types.VarCharType) {
return type.simpleString();
} else if (type instanceof Types.FixedCharType) {
return type.simpleString();
} else if (type instanceof Types.BinaryType) {
return type.simpleString();
} else if (type instanceof Types.ExternalType) {
return ((Types.ExternalType) type).catalogString();
}
throw new IllegalArgumentException(
String.format("Couldn't convert Gravitino type %s to OceanBase type", type.simpleString()));
}