{"record":{"id":"c2fbf2ba7a46264f","repo":"prestodb/presto","slug":"invalid-mapping-format-s-for-column-s","errorCode":null,"errorMessage":"invalid mapping format '%s' for column '%s'","messagePattern":"invalid mapping format '(.+?)' for column '(.+?)'","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"presto-record-decoder/src/main/java/com/facebook/presto/decoder/raw/RawColumnDecoder.java","lineNumber":103,"sourceCode":"            checkArgument(!columnHandle.isInternal(), \"unexpected internal column '%s'\", columnHandle.getName());\n            checkArgument(columnHandle.getFormatHint() == null, \"unexpected format hint '%s' defined for column '%s'\", columnHandle.getFormatHint(), columnHandle.getName());\n\n            columnName = columnHandle.getName();\n            columnType = columnHandle.getType();\n\n            try {\n                fieldType = columnHandle.getDataFormat() == null ?\n                        FieldType.BYTE :\n                        FieldType.valueOf(columnHandle.getDataFormat().toUpperCase(Locale.ENGLISH));\n            }\n            catch (IllegalArgumentException e) {\n                throw new IllegalArgumentException(format(\"invalid dataFormat '%s' for column '%s'\", columnHandle.getDataFormat(), columnName));\n            }\n\n            String mapping = Optional.ofNullable(columnHandle.getMapping()).orElse(\"0\");\n            Matcher mappingMatcher = MAPPING_PATTERN.matcher(mapping);\n            if (!mappingMatcher.matches()) {\n                throw new IllegalArgumentException(format(\"invalid mapping format '%s' for column '%s'\", mapping, columnName));\n            }\n            start = parseInt(mappingMatcher.group(1));\n            if (mappingMatcher.group(2) != null) {\n                end = OptionalInt.of(parseInt(mappingMatcher.group(2)));\n            }\n            else {\n                if (!isVarcharType(columnType)) {\n                    end = OptionalInt.of(start + fieldType.getSize());\n                }\n                else {\n                    end = OptionalInt.empty();\n                }\n            }\n\n            checkArgument(start >= 0, \"start offset %s for column '%s' must be greater or equal 0\", start, columnName);\n            end.ifPresent(endValue -> {\n                checkArgument(endValue >= 0, \"end offset %s for column '%s' must be greater or equal 0\", endValue, columnName);\n                checkArgument(endValue >= start, \"end offset %s for column '%s' must greater or equal start offset\", endValue, columnName);","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-record-decoder/src/main/java/com/facebook/presto/decoder/raw/RawColumnDecoder.java#L85-L121","documentation":"RawColumnDecoder's constructor parses the column's mapping with pattern (\\d+)(?::(\\d+))? — either a single byte offset or a 'start:end' byte range. If mapping does not match (e.g. contains letters, commas, or negative numbers), the constructor throws IllegalArgumentException \"invalid mapping format '%s' for column '%s'\" during table metadata construction.","triggerScenarios":"Creating a raw-decoder column with mapping like '10-20', 'name', '-1', '0:abc', or an empty-but-present value; MAPPING_PATTERN.matches() fails and the constructor throws immediately.","commonSituations":"Users porting mappings from other connectors that use different syntax (dash ranges, field names); copy-paste with whitespace inside quotes; attempting named-field mapping that only JSON/Avro decoders support.","solutions":["Use 'start' or 'start:end' with pure digit offsets, e.g. mapping='0' or mapping='0:8'.","Replace dash ranges ('0-8') with colon ranges ('0:8'); end offset is exclusive per decode logic.","Remove the mapping property to accept the default offset '0'.","Verify offsets are non-negative integers and match the record's byte layout."],"exampleFix":"// before: unsupported range syntax\n-- flags BIGINT WITH (data_format='INT', mapping='0-4')\n// after\n-- flags BIGINT WITH (data_format='INT', mapping='0:4')","handlingStrategy":"validation","validationCode":"Pattern MAPPING = Pattern.compile(\"\\\\d+(?::\\\\d+)?\");\nvoid checkRawMapping(String mapping) {\n  if (mapping != null && !MAPPING.matcher(mapping).matches())\n    throw new IllegalArgumentException(\"invalid raw mapping (use 'start' or 'start:end'): \" + mapping);\n}","typeGuard":null,"tryCatchPattern":"try { stmt.execute(ddl); } catch (SQLException e) { if (e.getMessage().contains(\"invalid mapping format\")) { rewriteMappingSyntax(); } else throw e; }","preventionTips":["Use only digit offsets with optional colon-separated end: '0', '0:8'.","Never reuse mapping syntax from JSON/Avro decoders (field names) for raw columns.","Unit-test your DDL generator against the (\\d+)(?::(\\d+))? pattern."],"tags":["presto","kafka-decoder","raw","mapping","configuration"],"backgroundTag":"invalid-column-config","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"}