{"record":{"id":"e346811a74f1887e","repo":"prestodb/presto","slug":"invalid-dataformat-s-for-column-s-e34681","errorCode":null,"errorMessage":"invalid dataFormat '%s' for column '%s'","messagePattern":"invalid dataFormat '(.+?)' 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":97,"sourceCode":"    private final OptionalInt end;\n\n    public RawColumnDecoder(DecoderColumnHandle columnHandle)\n    {\n        try {\n            requireNonNull(columnHandle, \"columnHandle is null\");\n            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                }","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-record-decoder/src/main/java/com/facebook/presto/decoder/raw/RawColumnDecoder.java#L79-L115","documentation":"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.","triggerScenarios":"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.","commonSituations":"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'.","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."],"exampleFix":"// before: invalid raw dataFormat\n-- payload VARBINARY WITH (data_format='bytes', mapping='0')\n// after\n-- payload BIGINT WITH (data_format='LONG', mapping='0:8')","handlingStrategy":"validation","validationCode":"Set<String> RAW_FORMATS = Set.of(\"BYTE\", \"SHORT\", \"INT\", \"LONG\", \"FLOAT\", \"DOUBLE\");\nvoid checkRawFormat(String dataFormat) {\n  if (dataFormat != null && !RAW_FORMATS.contains(dataFormat.toUpperCase(Locale.ROOT)))\n    throw new IllegalArgumentException(\"invalid raw dataFormat: \" + dataFormat);\n}","typeGuard":null,"tryCatchPattern":"try { conn.createStatement().execute(ddl); } catch (SQLException e) { if (e.getMessage().contains(\"invalid dataFormat\")) { fixDdlFormatName(); } else throw e; }","preventionTips":["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."],"tags":["presto","kafka-decoder","raw","ddl","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"}