{"record":{"id":"7fc0217c9dfd73cd","repo":"prestodb/presto","slug":"no-mapping-defined-for-column-s","errorCode":null,"errorMessage":"No mapping defined for column '%s'","messagePattern":"No mapping defined for column '(.+?)'","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"presto-kafka/src/main/java/com/facebook/presto/kafka/encoder/raw/RawRowEncoder.java","lineNumber":155,"sourceCode":"\n            Optional<String> mapping = Optional.ofNullable(columnHandle.getMapping());\n            if (mapping.isPresent()) {\n                Matcher mappingMatcher = MAPPING_PATTERN.matcher(mapping.get());\n                if (!mappingMatcher.matches()) {\n                    throw new IllegalArgumentException(format(\"Invalid mapping for column '%s'\", this.name));\n                }\n\n                if (mappingMatcher.group(2) != null) {\n                    this.start = parseOffset(mappingMatcher.group(1), \"start\", this.name);\n                    this.end = parseOffset(mappingMatcher.group(2), \"end\", this.name);\n                }\n                else {\n                    this.start = parseOffset(mappingMatcher.group(1), \"start\", this.name);\n                    this.end = this.start + this.fieldType.getSize();\n                }\n            }\n            else {\n                throw new IllegalArgumentException(format(\"No mapping defined for column '%s'\", this.name));\n            }\n        }\n\n        private static int parseOffset(String group, String offsetName, String columnName)\n        {\n            try {\n                return parseInt(group);\n            }\n            catch (NumberFormatException e) {\n                throw new IllegalArgumentException(format(\"Unable to parse '%s' offset for column '%s'\", offsetName, columnName), e);\n            }\n        }\n\n        private static FieldType parseFieldType(String dataFormat, String columnName)\n        {\n            try {\n                if (!dataFormat.isEmpty()) {\n                    return FieldType.valueOf(dataFormat.toUpperCase(Locale.ENGLISH));","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-kafka/src/main/java/com/facebook/presto/kafka/encoder/raw/RawRowEncoder.java#L137-L173","documentation":"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>'.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"// before (column without mapping)\n\"name\": \"id\", \"type\": \"BIGINT\"\n// after\n{\"name\": \"id\", \"type\": \"BIGINT\", \"mapping\": \"0-8\"}","handlingStrategy":"validation","validationCode":"// verify every column has a mapping before table creation\nfor (ColumnDef col : columns) {\n    if (col.mapping == null && !isImplicitField(col.name)) {\n        throw new IllegalArgumentException(\"Column missing mapping: \" + col.name);\n    }\n}\n","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["kafka","encoder","column-mapping","table-definition"],"backgroundTag":"missing-column-mapping","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}