{"record":{"id":"aca5ea58b3e275b4","repo":"prestodb/presto","slug":"unsupported-type-aca5ea","errorCode":null,"errorMessage":"Unsupported type: ","messagePattern":"Unsupported type: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"presto-orc/src/main/java/com/facebook/presto/orc/metadata/OrcMetadataWriter.java","lineNumber":208,"sourceCode":"            case CHAR:\n                return OrcProto.Type.Kind.CHAR;\n            case BINARY:\n                return OrcProto.Type.Kind.BINARY;\n            case DATE:\n                return OrcProto.Type.Kind.DATE;\n            case TIMESTAMP:\n            case TIMESTAMP_MICROSECONDS:\n                return OrcProto.Type.Kind.TIMESTAMP;\n            case LIST:\n                return OrcProto.Type.Kind.LIST;\n            case MAP:\n                return OrcProto.Type.Kind.MAP;\n            case STRUCT:\n                return OrcProto.Type.Kind.STRUCT;\n            case UNION:\n                return OrcProto.Type.Kind.UNION;\n        }\n        throw new IllegalArgumentException(\"Unsupported type: \" + orcTypeKind);\n    }\n\n    private static List<OrcProto.StringPair> toStringPairList(Map<String, String> attributes)\n    {\n        return attributes.entrySet().stream()\n                .map(entry -> OrcProto.StringPair.newBuilder()\n                        .setKey(entry.getKey())\n                        .setValue(entry.getValue())\n                        .build())\n                .collect(toImmutableList());\n    }\n\n    private static OrcProto.ColumnStatistics toColumnStatistics(ColumnStatistics columnStatistics)\n    {\n        OrcProto.ColumnStatistics.Builder builder = OrcProto.ColumnStatistics.newBuilder();\n\n        if (columnStatistics.hasNumberOfValues()) {\n            builder.setNumberOfValues(columnStatistics.getNumberOfValues());","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-orc/src/main/java/com/facebook/presto/orc/metadata/OrcMetadataWriter.java#L190-L226","documentation":"OrcMetadataWriter.toTypeKind() maps internal TypeKind values to ORC protobuf Type.Kind when writing ORC metadata. If an internal type kind has no case in the switch (e.g. a newly added type not yet mapped), it throws IllegalArgumentException(\"Unsupported type: ...\"). It is an exhaustiveness guard for type serialization.","triggerScenarios":"Writing an ORC file whose schema contains a TypeKind not covered by the switch, invoked from builder() during schema serialization.","commonSituations":"Using a Presto type that maps to a newer internal TypeKind than the writer supports; custom type plugins; version mismatch between type system and ORC writer.","solutions":["Remove or replace the unsupported type in the table/schema being written","Upgrade presto-orc so toTypeKind covers the type kind","Check the message suffix for the exact orcTypeKind value and map it in toTypeKind() if maintaining a fork"],"exampleFix":"// before\nTypeKind kind = type.getTypeKind(); // e.g. newly added JSON kind\nwriterBuilder.setType(...); // throws IllegalArgumentException\n// after\ncheckArgument(EnumSet.of(BOOLEAN, LONG, DOUBLE, STRING, LIST, MAP, STRUCT, UNION).contains(kind), \"Unsupported ORC type: %s\", kind);","handlingStrategy":"validation","validationCode":"// Validate schema types before writing ORC\nprivate static final Set<TypeKind> SUPPORTED = EnumSet.allOf(TypeKind.class); // keep in sync with toTypeKind\nfor (ColumnHandle col : columns) {\n    checkArgument(SUPPORTED.contains(typeKind(col)), \"Type not writable to ORC: %s\", col);\n}","typeGuard":"boolean isWritableToOrc(Type t) {\n    return !(t instanceof UnknownType) && orcdMappedKinds.contains(t.getTypeKind());\n}","tryCatchPattern":"try {\n    writer.appendRow(...);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"Unsupported type:\")) {\n        throw new IllegalStateException(\"Schema contains a type the ORC writer cannot serialize: \" + e.getMessage(), e);\n    }\n    throw e;\n}","preventionTips":["Restrict ORC tables to types with known ORC mappings","Upgrade writers before adding new types to schemas","Test CTAS/INSERT for new column types before rollout"],"tags":["orc","type-system","unsupported-type","metadata-writer"],"backgroundTag":"unsupported-type-kind","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"}