in src/main/java/com/aws/logaggregator/model/LogAppInitializer.java [62:110]
private DataType getDataType(String val, String format) {
switch (val.toLowerCase()) {
case "string":
return DataTypes.StringType;
case "boolean":
return DataTypes.BooleanType;
case "integer":
return DataTypes.IntegerType;
case "int":
return DataTypes.IntegerType;
case "double":
return DataTypes.DoubleType;
case "long":
return DataTypes.LongType;
case "decimal": {
if (format != null && format.indexOf(",") > 0) {
int precision = Integer.valueOf(format.substring(0, format.indexOf(",")));
int scale = Integer.valueOf(format.substring(format.indexOf(",") + 1));
return DataTypes.createDecimalType(precision, scale);
}
return DataTypes.createDecimalType();
}
case "bigint": {
return DataTypes.LongType;
}
case "biginteger": {
return DataTypes.LongType;
}
case "bigdecimal": {
if (format != null && format.indexOf(",") > 0) {
int precision = Integer.valueOf(format.substring(0, format.indexOf(",")));
int scale = Integer.valueOf(format.substring(format.indexOf(",") + 1));
return DataTypes.createDecimalType(precision, scale);
}
return DataTypes.createDecimalType();
}
case "date":
return DataTypes.DateType;
case "timestamp":
return DataTypes.TimestampType;
default:
return DataTypes.StringType;
}
}