in java/ws-server/src/main/java/com/epam/deltix/tbwg/webapp/model/grafana/TypeInfo.java [110:145]
public static ValueType type(DataType type) {
if (type instanceof IntegerDataType) {
int size = ((IntegerDataType) type).getNativeTypeSize();
if (size >= 6) {
return ValueType.LONG;
} else if (size == 4) {
return ValueType.INT;
} else if (size == 2) {
return ValueType.SHORT;
} else if (size == 1) {
return ValueType.BYTE;
}
} else if (type instanceof FloatDataType) {
FloatDataType fType = (FloatDataType) type;
if (fType.isFloat()) {
return ValueType.FLOAT;
} else if (fType.isDecimal64()) {
return ValueType.DECIMAL64;
} else {
return ValueType.DOUBLE;
}
} else if (type instanceof BooleanDataType) {
return ValueType.BOOLEAN;
} else if (type instanceof EnumDataType) {
return ValueType.ENUM;
} else if (type instanceof DateTimeDataType) {
return ValueType.DATETIME;
} else if (type instanceof VarcharDataType) {
return ValueType.VARCHAR;
} else if (type instanceof CharDataType) {
return ValueType.CHAR;
} else if (type instanceof TimeOfDayDataType) {
return ValueType.TIMEOFDAY;
}
throw new IllegalArgumentException("Unsupported type " + type.getClass().getSimpleName());
}