{"record":{"id":"c23453926396dbbc","repo":"prestodb/presto","slug":"unsupported-flat-map-key-type-c23453","errorCode":null,"errorMessage":"Unsupported flat map key type: ","messagePattern":"Unsupported flat map key type: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"presto-orc/src/main/java/com/facebook/presto/orc/reader/MapFlatSelectiveStreamReader.java","lineNumber":711,"sourceCode":"            return requiredLongKeys.isEmpty() || requiredLongKeys.contains(value.getKey().getIntKey());\n        }\n\n        return requiredStringKeys.isEmpty() || requiredStringKeys.contains(value.getKey().getBytesKey().toStringUtf8());\n    }\n\n    private Block getKeysBlock(List<DwrfSequenceEncoding> sequenceEncodings)\n    {\n        switch (keyOrcTypeKind) {\n            case BYTE:\n            case SHORT:\n            case INT:\n            case LONG:\n                return getIntegerKeysBlock(sequenceEncodings);\n            case STRING:\n            case BINARY:\n                return getSliceKeysBlock(sequenceEncodings);\n            default:\n                throw new IllegalArgumentException(\"Unsupported flat map key type: \" + keyOrcTypeKind);\n        }\n    }\n\n    private Block getIntegerKeysBlock(List<DwrfSequenceEncoding> sequenceEncodings)\n    {\n        Type keyType;\n\n        switch (keyOrcTypeKind) {\n            case BYTE:\n                keyType = TinyintType.TINYINT;\n                break;\n            case SHORT:\n                keyType = SmallintType.SMALLINT;\n                break;\n            case INT:\n                keyType = IntegerType.INTEGER;\n                break;\n            case LONG:","sourceCodeStart":693,"sourceCodeEnd":729,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-orc/src/main/java/com/facebook/presto/orc/reader/MapFlatSelectiveStreamReader.java#L693-L729","documentation":"MapFlatSelectiveStreamReader creates the key block for flat-map (DWRF_MAP_FLAT) columns. Only INTEGER and LONG key kinds (and STRING/BINARY via getSliceKeysBlock) are supported; any other key ORC type kind throws IllegalArgumentException. This is a limitation of the selective flat-map reader's supported key types.","triggerScenarios":"Constructing MapFlatSelectiveStreamReader for a flat map column whose key type kind is not INTEGER, LONG, STRING, or BINARY (e.g., BYTE, SHORT, VARCHAR variants not mapped, FLOAT, structural kinds).","commonSituations":"Files written with flat map keys of uncommon types; writer/reader version skew; falling into the selective path for maps expected to have simple keys.","solutions":["Use a flat-map key ORC type among INTEGER, LONG, STRING, or BINARY","Re-encode the file with a supported key type","Use the non-selective (batch) reader or a non-flat map encoding","Verify the ORC/DWRF writer settings used to produce the file"],"exampleFix":"// before\nthrow new IllegalArgumentException(\"Unsupported flat map key type: \" + keyOrcTypeKind);\n// after\nif (!SUPPORTED_FLAT_KEY_KINDS.contains(keyOrcTypeKind)) { throw new OrcCorruptionException(id, \"Unsupported flat map key type: \" + keyOrcTypeKind); }","handlingStrategy":"validation","validationCode":"Set<OrcTypeKind> ok = EnumSet.of(INTEGER, LONG, STRING, BINARY); if (!ok.contains(keyOrcTypeKind)) { throw new IllegalArgumentException(\"Unsupported flat map key: \" + keyOrcTypeKind); }","typeGuard":"boolean supportsFlatMapKey(OrcTypeKind t) { return t == INTEGER || t == LONG || t == STRING || t == BINARY; }","tryCatchPattern":"try { reader = createReader(descriptor, ...); } catch (IllegalArgumentException e) { if (e.getMessage().contains(\"Unsupported flat map key\")) { fallbackToBatchReader(descriptor); } else throw e; }","preventionTips":["Enforce supported key kinds (INT/LONG/STRING/BINARY) in writer configs","Validate stripe encoding metadata before using selective readers","Keep presto-orc updated for newly supported key kinds","Test flat-map files produced by your writer against your reader version"],"tags":["orc","dwrf","flat-map","unsupported-type"],"backgroundTag":"unsupported-orc-type","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"}