in java/clickhouse-client/src/main/java/com/epam/deltix/clickhouse/util/ParseHelper.java [123:196]
private static SqlDataType parseSimpleDataType(DataTypes requestedType, Class<?> currentType) {
if (requestedType == null)
return getDefaultDataTypeByClass(currentType);
switch (requestedType) {
case ENUM8:
case ENUM16:
validateEnumDataType(requestedType, currentType);
List<Enum8DataType.Enum8Value> values = getEnumValues(currentType);
return new Enum8DataType(values);
case STRING:
case FIXED_STRING:
validateStringDataType(requestedType, currentType);
return new StringDataType();
case UINT8:
validateUInt8DataType(requestedType, currentType);
return new UInt8DataType();
case UINT16:
case UINT32:
case UINT64:
throw unsupportedDataTypeException(requestedType, currentType);
case INT8:
validateInt8DataType(requestedType, currentType);
return new Int8DataType();
case INT16:
validateInt16DataType(requestedType, currentType);
return new Int16DataType();
case INT32:
validateInt32DataType(requestedType, currentType);
return new Int32DataType();
case INT64:
validateInt64DataType(requestedType, currentType);
return new Int64DataType();
case FLOAT32:
validateFloat32DataType(requestedType, currentType);
return new Float32DataType();
case FLOAT64:
validateFloat64DataType(requestedType, currentType);
return new Float64DataType();
case DECIMAL:
validateDecimalDataType(requestedType, currentType);
return new DecimalDataType(DEFAULT_DECIMAL_PRECISION, DEFAULT_DECIMAL_SCALE);
case DECIMAL32:
validateDecimalDataType(requestedType, currentType);
return new Decimal32DataType(DEFAULT_DECIMAL_SCALE);
case DECIMAL64:
validateDecimalDataType(requestedType, currentType);
return new Decimal64DataType(DEFAULT_DECIMAL_SCALE);
case DECIMAL128:
validateDecimalDataType(requestedType, currentType);
return new Decimal128DataType(DEFAULT_DECIMAL_SCALE);
case DATE:
validateDateDataType(requestedType, currentType);
return new DateDataType();
case DATE_TIME:
validateDateTimeDataType(requestedType, currentType);
return new DateTimeDataType();
case DATE_TIME64:
validateDateTimeDataType(requestedType, currentType);
return new DateTime64DataType();
default:
throw unsupportedDataTypeException(requestedType);
}
}