{"record":{"id":"9d9b2f7ae5f6cfdd","repo":"prestodb/presto","slug":"unsupported-hive-type-s-9d9b2f","errorCode":null,"errorMessage":"Unsupported Hive type: %s","messagePattern":"Unsupported Hive type: (.+?)","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"presto-orc/src/main/java/com/facebook/presto/orc/metadata/OrcType.java","lineNumber":260,"sourceCode":"            return ImmutableList.of(new OrcType(OrcTypeKind.DECIMAL, decimalType.getPrecision(), decimalType.getScale()));\n        }\n        if (type.getTypeSignature().getBase().equals(ARRAY)) {\n            return createOrcArrayType(nextFieldTypeIndex, type.getTypeParameters().get(0));\n        }\n        if (type.getTypeSignature().getBase().equals(MAP)) {\n            return createOrcMapType(nextFieldTypeIndex, type.getTypeParameters().get(0), type.getTypeParameters().get(1));\n        }\n        if (type.getTypeSignature().getBase().equals(ROW)) {\n            List<String> fieldNames = new ArrayList<>();\n            for (int i = 0; i < type.getTypeSignature().getParameters().size(); i++) {\n                TypeSignatureParameter parameter = type.getTypeSignature().getParameters().get(i);\n                fieldNames.add(parameter.getNamedTypeSignature().getName().orElse(\"field\" + i));\n            }\n            List<Type> fieldTypes = type.getTypeParameters();\n\n            return createOrcRowType(nextFieldTypeIndex, fieldNames, fieldTypes);\n        }\n        throw new NotSupportedException(format(\"Unsupported Hive type: %s\", type));\n    }\n\n    private static List<OrcType> createOrcArrayType(int nextFieldTypeIndex, Type itemType)\n    {\n        nextFieldTypeIndex++;\n        List<OrcType> itemTypes = toOrcType(nextFieldTypeIndex, itemType);\n\n        List<OrcType> orcTypes = new ArrayList<>();\n        orcTypes.add(new OrcType(OrcTypeKind.LIST, ImmutableList.of(nextFieldTypeIndex), ImmutableList.of(\"item\")));\n        orcTypes.addAll(itemTypes);\n        return orcTypes;\n    }\n\n    private static List<OrcType> createOrcMapType(int nextFieldTypeIndex, Type keyType, Type valueType)\n    {\n        nextFieldTypeIndex++;\n        List<OrcType> keyTypes = toOrcType(nextFieldTypeIndex, keyType);\n        List<OrcType> valueTypes = toOrcType(nextFieldTypeIndex + keyTypes.size(), valueType);","sourceCodeStart":242,"sourceCodeEnd":278,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-orc/src/main/java/com/facebook/presto/orc/metadata/OrcType.java#L242-L278","documentation":"OrcType.toOrcType() converts a Hive/Presto Type into an ORC type tree. Only row/columnar types are handled in this branch; any other type reaches a NotSupportedException(\"Unsupported Hive type: %s\"). Called recursively via itemTypes/keyTypes/valueTypes/fieldOrcTypes when building nested ORC type trees.","triggerScenarios":"Writing ORC output for a Hive/Presto type that is not array/map/row/struct (e.g. a parameterized or custom type falling through the switch), including nested inside containers via itemTypes/keyTypes/valueTypes/fieldOrcTypes.","commonSituations":"CTAS or INSERT into ORC tables with exotic column types (e.g. custom parametric types, unknown functions-of-types); connector plugins exposing non-mappable types; Presto version gaps for newer Hive types.","solutions":["Coerce the column to a supported Hive type (e.g. CAST to VARCHAR/ROW/etc.) before writing","Upgrade Presto so toOrcType handles the type","Identify the offending type from the message and exclude/cast it in the schema"],"exampleFix":"// before\nCREATE TABLE t WITH (format='ORC') AS SELECT custom_type_col FROM src; -- NotSupportedException\n// after\nCREATE TABLE t WITH (format='ORC') AS SELECT CAST(custom_type_col AS VARCHAR) AS custom_type_col FROM src;","handlingStrategy":"validation","validationCode":"// Before writing, verify each Hive column type is ORC-mappable\nprivate static final Set<String> SUPPORTED_ROOTS = Set.of(\"array\", \"map\", \"row\");\nString base = type.getBaseType().toLowerCase(Locale.ROOT);\nif (!SUPPORTED_ROOTS.contains(base)) {\n    throw new IllegalArgumentException(\"Coerce or drop column of type \" + type + \" before ORC write\");\n}","typeGuard":"boolean isOrcMappable(Type type) {\n    String base = type.getBaseType().toLowerCase(Locale.ROOT);\n    return Set.of(\"array\", \"map\", \"row\").contains(base);\n}","tryCatchPattern":"try {\n    orcType = OrcType.toOrcType(tableName, hiveTypes);\n} catch (NotSupportedException e) {\n    throw new IllegalStateException(\"Column type not writable to ORC: \" + e.getMessage() + \"; CAST it to a supported type\", e);\n}","preventionTips":["CAST exotic types to VARCHAR or structured types before ORC writes","Keep table schemas within the connector's supported ORC type list","Test new column types against ORC CTAS in a staging environment"],"tags":["orc","hive-types","type-mapping","not-supported"],"backgroundTag":"unsupported-hive-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"}