prestodb/presto · error · IllegalArgumentException
invalid dataFormat '%s' for column '%s'
Error message
invalid dataFormat '%s' for column '%s'
What it means
RawColumnDecoder's constructor validates the column's dataFormat by FieldType.valueOf(dataFormat.toUpperCase(Locale.ENGLISH)); legal values are BYTE, SHORT, INT, LONG, FLOAT, DOUBLE. Any other string makes valueOf throw IllegalArgumentException, which is rethrown with the message "invalid dataFormat '%s' for column '%s'" at decoder-construction time (table creation / metadata load), not at query time.
Source
Thrown at presto-record-decoder/src/main/java/com/facebook/presto/decoder/raw/RawColumnDecoder.java:97
private final OptionalInt end;
public RawColumnDecoder(DecoderColumnHandle columnHandle)
{
try {
requireNonNull(columnHandle, "columnHandle is null");
checkArgument(!columnHandle.isInternal(), "unexpected internal column '%s'", columnHandle.getName());
checkArgument(columnHandle.getFormatHint() == null, "unexpected format hint '%s' defined for column '%s'", columnHandle.getFormatHint(), columnHandle.getName());
columnName = columnHandle.getName();
columnType = columnHandle.getType();
try {
fieldType = columnHandle.getDataFormat() == null ?
FieldType.BYTE :
FieldType.valueOf(columnHandle.getDataFormat().toUpperCase(Locale.ENGLISH));
}
catch (IllegalArgumentException e) {
throw new IllegalArgumentException(format("invalid dataFormat '%s' for column '%s'", columnHandle.getDataFormat(), columnName));
}
String mapping = Optional.ofNullable(columnHandle.getMapping()).orElse("0");
Matcher mappingMatcher = MAPPING_PATTERN.matcher(mapping);
if (!mappingMatcher.matches()) {
throw new IllegalArgumentException(format("invalid mapping format '%s' for column '%s'", mapping, columnName));
}
start = parseInt(mappingMatcher.group(1));
if (mappingMatcher.group(2) != null) {
end = OptionalInt.of(parseInt(mappingMatcher.group(2)));
}
else {
if (!isVarcharType(columnType)) {
end = OptionalInt.of(start + fieldType.getSize());
}
else {
end = OptionalInt.empty();
}View on GitHub (pinned to 55bb57d202)
Solutions
- Use one of the supported raw dataFormats: BYTE, SHORT, INT, LONG, FLOAT, DOUBLE (case-insensitive).
- Remove data_format entirely if you want the default (BYTE).
- If you intended raw text, decode to VARCHAR — raw columns require a varchar column type, not a string dataFormat.
- Check the connector documentation for the exact FieldType enum names before authoring DDL.
Example fix
// before: invalid raw dataFormat -- payload VARBINARY WITH (data_format='bytes', mapping='0') // after -- payload BIGINT WITH (data_format='LONG', mapping='0:8')
Defensive patterns
Strategy: validation
Validate before calling
Set<String> RAW_FORMATS = Set.of("BYTE", "SHORT", "INT", "LONG", "FLOAT", "DOUBLE");
void checkRawFormat(String dataFormat) {
if (dataFormat != null && !RAW_FORMATS.contains(dataFormat.toUpperCase(Locale.ROOT)))
throw new IllegalArgumentException("invalid raw dataFormat: " + dataFormat);
} Try / catch
try { conn.createStatement().execute(ddl); } catch (SQLException e) { if (e.getMessage().contains("invalid dataFormat")) { fixDdlFormatName(); } else throw e; } Prevention
- Only use BYTE/SHORT/INT/LONG/FLOAT/DOUBLE for raw columns.
- Validate DDL with a linter/test against a scratch catalog before production.
- Remember raw decoders ignore per-field names — dataFormat here is a binary field type, not a codec name.
When it happens
Trigger: Defining a Kafka raw-decoder column with an unsupported dataFormat, e.g. data_format='BYTES', 'binary', 'string', or 'int64'; thrown from the RawColumnDecoder public constructor while building the column decoders.
Common situations: Copy-pasted table DDL from a JSON/Avro decoder topic where dataFormat strings differ; case/tense mistakes ('byte' works, 'bytes' does not); typos like 'integer' instead of 'int'.
Related errors
- invalid mapping format '%s' for column '%s'
- Wrong dataFormat '%s' specified for column '%s'; %s type imp
- DECODER_CONVERSION_NOT_SUPPORTED
- ACCUMULO_TABLE_EXISTS
- NOT_SUPPORTED
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/e346811a74f1887e.
Report an issue: GitHub.