prestodb/presto · error · IllegalArgumentException
Invalid dataFormat '%s' for column '%s'
Error message
Invalid dataFormat '%s' for column '%s'
What it means
RawKafkaEncoder's ColumnMapping parses each column's 'dataFormat' property into a FieldType enum via valueOf. If the supplied dataFormat string is not one of the valid FieldType names (e.g. BYTE, SHORT, INT, LONG, FLOAT, DOUBLE, STRING), valueOf throws IllegalArgumentException which is rethrown with the column name for context.
Source
Thrown at presto-kafka/src/main/java/com/facebook/presto/kafka/encoder/raw/RawRowEncoder.java:178
{
try {
return parseInt(group);
}
catch (NumberFormatException e) {
throw new IllegalArgumentException(format("Unable to parse '%s' offset for column '%s'", offsetName, columnName), e);
}
}
private static FieldType parseFieldType(String dataFormat, String columnName)
{
try {
if (!dataFormat.isEmpty()) {
return FieldType.valueOf(dataFormat.toUpperCase(Locale.ENGLISH));
}
return FieldType.BYTE;
}
catch (IllegalArgumentException e) {
throw new IllegalArgumentException(format("Invalid dataFormat '%s' for column '%s'", dataFormat, columnName));
}
}
private static void checkFieldType(String columnName, Type columnType, FieldType fieldType)
{
if (columnType == BIGINT) {
checkFieldTypeOneOf(fieldType, columnName, columnType, FieldType.BYTE, FieldType.SHORT, FieldType.INT, FieldType.LONG);
}
else if (columnType == INTEGER) {
checkFieldTypeOneOf(fieldType, columnName, columnType, FieldType.BYTE, FieldType.SHORT, FieldType.INT);
}
else if (columnType == SMALLINT) {
checkFieldTypeOneOf(fieldType, columnName, columnType, FieldType.BYTE, FieldType.SHORT);
}
else if (columnType == TINYINT) {
checkFieldTypeOneOf(fieldType, columnName, columnType, FieldType.BYTE);
}
else if (columnType == BOOLEAN) {View on GitHub (pinned to 55bb57d202)
Solutions
- Check valid FieldType enum values in RawRowEncoder and use one of them as dataFormat
- Fix the typo in the column's dataFormat property
- Remove the dataFormat property so the column defaults to BYTE
- If an alias like INTEGER is needed, map it to a supported FieldType before valueOf
Example fix
// before dataFormat = 'INTEGER' // after dataFormat = 'INT'
Defensive patterns
Strategy: validation
Validate before calling
Set<String> valid = Set.of("BYTE","SHORT","INT","LONG","FLOAT","DOUBLE","STRING");
if (dataFormat != null && !dataFormat.isEmpty() && !valid.contains(dataFormat.toUpperCase(Locale.ENGLISH))) {
throw new IllegalArgumentException("Invalid dataFormat '" + dataFormat + "' for column '" + columnName + "'");
} Type guard
boolean isValidFieldType(String dataFormat) {
try { FieldType.valueOf(dataFormat.toUpperCase(Locale.ENGLISH)); return true; }
catch (IllegalArgumentException e) { return false; }
} Try / catch
try {
Map<String,Object> props = parseColumnProps(col);
} catch (IllegalArgumentException e) {
if (e.getMessage().startsWith("Invalid dataFormat")) { log.error("Fix dataFormat: {}", e.getMessage()); }
throw e;
} Prevention
- List dataFormat values only from the FieldType enum, not free text
- Validate the full table definition against allowed values before CREATE TABLE
- Prefer omitting dataFormat to get the BYTE default when unsure
When it happens
Trigger: Kafka topic message format definition (CREATE TABLE ... WITH format=...) declares a raw-encoding column with dataFormat set to an unrecognized string such as 'INTEGER' instead of 'INT', or a typo like 'lng'.
Common situations: Users copy raw-encoder configs between connectors with different type names; typos in table definitions; case is handled (toUpperCase) so 'int' works but 'integer' or 'int64' does not.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Invalid Kafka Offset start/end pair: %s - %s
- ACCUMULO_TABLE_EXISTS
- UNEXPECTED_ACCUMULO_ERROR
- NOT_SUPPORTED
- ARROW_INTERNAL_ERROR
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/9e24c18dca8da282.
Report an issue: GitHub.