in metacat-connector-mysql/src/main/java/com/netflix/metacat/connector/mysql/MySqlTypeConverter.java [48:111]
public Type toMetacatType(@Nonnull @NonNull final String type) {
// see: https://dev.mysql.com/doc/connector-j/6.0/en/connector-j-reference-type-conversions.html
final String lowerType = type.toLowerCase();
// Split up the possible type: TYPE[(size, magnitude)] EXTRA
final String[] splitType = this.splitType(lowerType);
switch (splitType[0]) {
case "bit":
return this.toMetacatBitType(splitType);
case "tinyint":
// TODO: MySQL generally treats this as boolean should we? Not according to spreadsheet currently
return BaseType.TINYINT;
case "bool":
case "boolean":
return BaseType.BOOLEAN;
case "smallint":
return BaseType.SMALLINT;
case "mediumint":
case "int":
case "integer":
return BaseType.INT;
case "bigint":
return BaseType.BIGINT;
case "float": // TODO: MySQL precision is lost
return BaseType.FLOAT;
case "double":
case "double precision":
return BaseType.DOUBLE;
case "decimal":
case "dec":
return this.toMetacatDecimalType(splitType);
case "date":
return BaseType.DATE;
case "time":
return this.toMetacatTimeType(splitType);
case "datetime":
case "timestamp":
return this.toMetacatTimestampType(splitType);
case "char":
return this.toMetacatCharType(splitType);
case "varchar":
return this.toMetacatVarcharType(splitType);
case "binary":
case "tinyblob":
case "blob":
case "mediumblob":
case "longblob":
case "varbinary":
return this.toMetacatVarbinaryType(splitType);
case "tinytext":
case "text":
case "mediumtext":
case "longtext":
return BaseType.STRING;
case "json":
return BaseType.JSON;
case "year":
case "enum":
case "set":
default:
log.info("Encountered {} type. Returning Unknown type.", splitType[0]);
return BaseType.UNKNOWN;
}
}