prestodb/presto · error · IllegalArgumentException
No mapping defined for column '%s'
Error message
No mapping defined for column '%s'
What it means
RawRowEncoder requires every non-null, non-VARCHAR-exempt column to carry an explicit byte mapping for raw (byte-slice) decoding. If the column handle has no mapping at all, the ColumnMapping constructor throws IllegalArgumentException 'No mapping defined for column <name>'.
Source
Thrown at presto-kafka/src/main/java/com/facebook/presto/kafka/encoder/raw/RawRowEncoder.java:155
Optional<String> mapping = Optional.ofNullable(columnHandle.getMapping());
if (mapping.isPresent()) {
Matcher mappingMatcher = MAPPING_PATTERN.matcher(mapping.get());
if (!mappingMatcher.matches()) {
throw new IllegalArgumentException(format("Invalid mapping for column '%s'", this.name));
}
if (mappingMatcher.group(2) != null) {
this.start = parseOffset(mappingMatcher.group(1), "start", this.name);
this.end = parseOffset(mappingMatcher.group(2), "end", this.name);
}
else {
this.start = parseOffset(mappingMatcher.group(1), "start", this.name);
this.end = this.start + this.fieldType.getSize();
}
}
else {
throw new IllegalArgumentException(format("No mapping defined for column '%s'", this.name));
}
}
private static int parseOffset(String group, String offsetName, String columnName)
{
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));View on GitHub (pinned to 55bb57d202)
Solutions
- Add a mapping to the column definition in the topic's data table, e.g. "mapping": "0-8" covering the bytes holding the value.
- Use a built-in mapping keyword supported by the encoder (e.g. '_message' or '_key') if the column should map to whole message content.
- Drop the column from the table definition if it is not actually decoded from the Kafka message.
Example fix
// before (column without mapping)
"name": "id", "type": "BIGINT"
// after
{"name": "id", "type": "BIGINT", "mapping": "0-8"} Defensive patterns
Strategy: validation
Validate before calling
// verify every column has a mapping before table creation
for (ColumnDef col : columns) {
if (col.mapping == null && !isImplicitField(col.name)) {
throw new IllegalArgumentException("Column missing mapping: " + col.name);
}
}
Prevention
- Add a 'mapping' property to every column in raw-format Kafka topic definitions.
- When copying table definitions across data formats (json/avro/raw), re-add mappings.
- Lint topic definition files for the presence of mapping on all columns.
When it happens
Trigger: Creating a Kafka table over the raw data format where a column definition omits the 'mapping' property entirely (and no default like a message/key field is used).
Common situations: New column added to the table definition without updating its mapping; copy of a table definition from a row/json encoder that does not require mappings; column intended as a metadata field but the raw encoder requires an explicit mapping for it.
Related errors
- Mapping length '%s' is not equal to expected length '%s' for
- Invalid mapping for column '%s'
- Unable to parse '%s' offset for column '%s'
- unexpected internal column '%s'
- Column '%s' does not support 'null' value
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/7fc0217c9dfd73cd.
Report an issue: GitHub.