{"record":{"id":"13bb29e4edf7de36","repo":"prestodb/presto","slug":"hive-invalid-metadata-13bb29","errorCode":"HIVE_INVALID_METADATA","errorMessage":"Invalid Hive struct type: %s","messagePattern":"Invalid Hive struct type: (.+?)","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-hive-metastore/src/main/java/com/facebook/presto/hive/HiveType.java","lineNumber":344,"sourceCode":"            case MAP:\n                MapTypeInfo mapTypeInfo = (MapTypeInfo) typeInfo;\n                TypeSignature keyType = getTypeSignature(mapTypeInfo.getMapKeyTypeInfo());\n                TypeSignature valueType = getTypeSignature(mapTypeInfo.getMapValueTypeInfo());\n                return new TypeSignature(\n                        StandardTypes.MAP,\n                        ImmutableList.of(TypeSignatureParameter.of(keyType), TypeSignatureParameter.of(valueType)));\n            case LIST:\n                ListTypeInfo listTypeInfo = (ListTypeInfo) typeInfo;\n                TypeSignature elementType = getTypeSignature(listTypeInfo.getListElementTypeInfo());\n                return new TypeSignature(\n                        StandardTypes.ARRAY,\n                        ImmutableList.of(TypeSignatureParameter.of(elementType)));\n            case STRUCT:\n                StructTypeInfo structTypeInfo = (StructTypeInfo) typeInfo;\n                List<TypeInfo> structFieldTypeInfos = structTypeInfo.getAllStructFieldTypeInfos();\n                List<String> structFieldNames = structTypeInfo.getAllStructFieldNames();\n                if (structFieldTypeInfos.size() != structFieldNames.size()) {\n                    throw new PrestoException(HiveErrorCode.HIVE_INVALID_METADATA, format(\"Invalid Hive struct type: %s\", typeInfo));\n                }\n                ImmutableList.Builder<TypeSignatureParameter> typeSignatureBuilder = ImmutableList.builder();\n                for (int i = 0; i < structFieldTypeInfos.size(); i++) {\n                    TypeSignature typeSignature = getTypeSignature(structFieldTypeInfos.get(i));\n                    // Lower case the struct field names.\n                    // Otherwise, Presto will refuse to write to columns whose struct type has field names containing upper case characters.\n                    // Users can't work around this by casting in their queries because Presto parser always lower case types.\n                    // TODO: This is a hack. Presto engine should be able to handle identifiers in a case insensitive way where necessary.\n                    String rowFieldName = structFieldNames.get(i).toLowerCase(Locale.US);\n                    typeSignatureBuilder.add(TypeSignatureParameter.of(new NamedTypeSignature(Optional.of(new RowFieldName(rowFieldName, false)), typeSignature)));\n                }\n                return new TypeSignature(StandardTypes.ROW, typeSignatureBuilder.build());\n        }\n        throw new PrestoException(NOT_SUPPORTED, format(\"Unsupported Hive type: %s\", typeInfo));\n    }\n\n    public static Type getPrimitiveType(PrimitiveTypeInfo typeInfo)\n    {","sourceCodeStart":326,"sourceCodeEnd":362,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-hive-metastore/src/main/java/com/facebook/presto/hive/HiveType.java#L326-L362","documentation":"getTypeSignature hits its default branch when converting a Hive TypeInfo to a Presto type signature and encounters a Hive type it does not handle (e.g. an unknown or unsupported struct/type category returned by the metastore). It signals a type not representable in the connector's type mapping.","triggerScenarios":"Thrown at presto-hive-metastore/src/main/java/com/facebook/presto/hive/HiveType.java:344 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the actual Hive column type and change it to a supported type (primitive, struct, map, list)","Ensure the Hive metastore returns standard TypeInfos; custom or corrupt type strings must be fixed at the metastore"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}