{"record":{"id":"d6fef64999af808d","repo":"prestodb/presto","slug":"unable-to-parse-s-offset-for-column-s","errorCode":null,"errorMessage":"Unable to parse '%s' offset for column '%s'","messagePattern":"Unable to parse '(.+?)' offset 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":165,"sourceCode":"                    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));\n                }\n                return FieldType.BYTE;\n            }\n            catch (IllegalArgumentException e) {\n                throw new IllegalArgumentException(format(\"Invalid dataFormat '%s' for column '%s'\", dataFormat, columnName));\n            }\n        }\n\n        private static void checkFieldType(String columnName, Type columnType, FieldType fieldType)\n        {","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-kafka/src/main/java/com/facebook/presto/kafka/encoder/raw/RawRowEncoder.java#L147-L183","documentation":"RawRowEncoder.parseOffset converts the start/end groups of a matched mapping string to integers via parseInt. A NumberFormatException is rethrown as IllegalArgumentException 'Unable to parse <start|end> offset for column <name>', chaining the original exception.","triggerScenarios":"A mapping like '01234567890123-5' (offset exceeding Integer.MAX_VALUE) or a mapping that matched the pattern with a group too large/non-numeric, parsed as a start or end offset for the column.","commonSituations":"Mapping offsets past 2^31-1 in very large messages; leading '+' sign or other characters accepted by the regex but not parseInt; accidental concatenation in templated config producing huge numbers.","solutions":["Use integer offsets within Integer range for both start and end in the mapping string (e.g. '0-8', not '99999999999-100000000007').","Ensure offsets are plain decimal digits with no sign or whitespace.","If the message is genuinely that large, remap the needed bytes at smaller offsets or switch to a structured data format."],"exampleFix":"// before\n\"mapping\": \"2147483648-2147483655\"\n// after\n\"mapping\": \"0-7\"","handlingStrategy":"validation","validationCode":"// ensure offsets are plain integers within range before using them\nlong off = Long.parseLong(group); // fail fast on bad input\nif (off < 0 || off > Integer.MAX_VALUE) {\n    throw new IllegalArgumentException(\"Offset out of int range: \" + group);\n}\n","typeGuard":null,"tryCatchPattern":"try {\n    createKafkaTable(defn);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"Unable to parse\")) {\n        // fix the named column's start/end offsets to plain decimal ints\n    }\n    throw e;\n}","preventionTips":["Use plain decimal offsets without signs, whitespace, or leading '+' characters.","Keep offsets under 2^31-1; message slices are int-indexed.","Compute end offsets with a script (start + typeSize) rather than typing large literals by hand."],"tags":["kafka","encoder","column-mapping","number-format"],"backgroundTag":"invalid-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"}