in metacat-connector-snowflake/src/main/java/com/netflix/metacat/connector/snowflake/SnowflakeTypeConverter.java [46:110]
public Type toMetacatType(final String type) {
final String lowerType = type.toLowerCase();
// Split up the possible type: TYPE[(size, magnitude)] EXTRA
final String[] splitType = this.splitType(lowerType);
switch (splitType[0]) {
case "smallint":
case "tinyint":
case "byteint":
return BaseType.SMALLINT;
case "int":
case "integer":
return BaseType.INT;
case "bigint":
return BaseType.BIGINT;
case "number":
case "decimal":
case "numeric":
return this.toMetacatDecimalType(splitType);
case "real":
case "float4":
return BaseType.FLOAT;
case "double":
case "double precision":
case "float8":
case "float":
return BaseType.DOUBLE;
case "varchar":
fixDataSizeIfIncorrect(splitType);
return this.toMetacatVarcharType(splitType);
case "text":
case "string":
// text is basically alias for VARCHAR(256)
splitType[1] = DEFAULT_CHARACTER_LENGTH_STRING;
return this.toMetacatVarcharType(splitType);
case "character":
case "char":
fixDataSizeIfIncorrect(splitType);
return this.toMetacatCharType(splitType);
case "binary":
case "varbinary":
fixDataSizeIfIncorrect(splitType);
return this.toMetacatVarbinaryType(splitType);
case "timestamp":
case "datetime":
case "timestamp_ntz":
case "timestampntz":
case "timestamp without time zone":
return this.toMetacatTimestampType(splitType);
case "timestamp_tz":
case "timestamptz":
case "timestampltz":
case "timestamp_ltz":
case "timestamp with local time zone":
case "timestamp with time zone":
return BaseType.TIMESTAMP_WITH_TIME_ZONE;
case "date":
return BaseType.DATE;
case "boolean":
return BaseType.BOOLEAN;
default:
log.info("Unhandled or unknown Snowflake type {}", splitType[0]);
return BaseType.UNKNOWN;
}
}