{"record":{"id":"b5fd399cbf9b7a27","repo":"apache/iceberg","slug":"unknown-type-category","errorCode":null,"errorMessage":"Unknown type <category>","messagePattern":"Unknown type <category>","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hive-metastore/src/main/java/org/apache/iceberg/hive/HiveSchemaConverter.java","lineNumber":155,"sourceCode":"            convertInternal(\n                structTypeInfo.getAllStructFieldNames(),\n                structTypeInfo.getAllStructFieldTypeInfos(),\n                Collections.emptyList());\n        return Types.StructType.of(fields);\n      case MAP:\n        MapTypeInfo mapTypeInfo = (MapTypeInfo) typeInfo;\n        Type keyType = convertType(mapTypeInfo.getMapKeyTypeInfo());\n        Type valueType = convertType(mapTypeInfo.getMapValueTypeInfo());\n        int keyId = id++;\n        int valueId = id++;\n        return Types.MapType.ofOptional(keyId, valueId, keyType, valueType);\n      case LIST:\n        ListTypeInfo listTypeInfo = (ListTypeInfo) typeInfo;\n        Type listType = convertType(listTypeInfo.getListElementTypeInfo());\n        return Types.ListType.ofOptional(id++, listType);\n      case UNION:\n      default:\n        throw new IllegalArgumentException(\"Unknown type \" + typeInfo.getCategory());\n    }\n  }\n}\n","sourceCodeStart":137,"sourceCodeEnd":159,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/hive-metastore/src/main/java/org/apache/iceberg/hive/HiveSchemaConverter.java#L137-L159","documentation":"HiveSchemaConverter.convertType throws IllegalArgumentException for Hive type categories it does not handle — UNION explicitly falls into UNION/default with this error. Iceberg has no union type, so conversion cannot proceed.","triggerScenarios":"Calling HiveSchemaConverter.convert on a TypeInfo tree containing a UNION type (Hive uniontype columns) or any unrecognized category.","commonSituations":"Migrating Hive tables that use uniontype columns; schemas produced by ETL frameworks that emit Hive unions; corrupted/unknown category values from unusual metastore versions.","solutions":["Flatten the uniontype column into separate concrete columns (one per variant) before conversion.","Convert the union member types manually and store as a struct, string, or binary if a lossless mapping is not needed.","Extend HiveSchemaConverter with a UNION case mapping to a chosen Iceberg type if your workload needs it."],"exampleFix":"// before\n-- col: uniontype<int,string>\n// after\nALTER TABLE events CHANGE COLUMN col col struct<a:int,b:string>; // or explode to typed columns","handlingStrategy":"validation","validationCode":"if (hiveSchema.contains(unionTypeInfo)) { throw new IllegalArgumentException(\"Flatten uniontype columns before conversion\"); }","typeGuard":"boolean isUnion(TypeInfo ti) { return ti.getCategory() == ObjectInspector.Category.UNION; }","tryCatchPattern":"try { schema = HiveSchemaConverter.convert(typeInfo); } catch (IllegalArgumentException e) { /* flatten union columns and retry */ }","preventionTips":["Avoid uniontype columns in tables targeted for Iceberg migration.","Scan DDL for 'uniontype' before conversion runs.","Model variant data as struct columns in Hive."],"tags":["schema-conversion","union-type","hive"],"backgroundTag":"unsupported-operation","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}