{"record":{"id":"b034ca39c2717eb8","repo":"apache/iceberg","slug":"unsupported-hive-type-category-for-iceberg-tab","errorCode":null,"errorMessage":"Unsupported Hive type (<category>) for Iceberg tables.","messagePattern":"Unsupported Hive type \\(<category>\\) for Iceberg tables\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hive-metastore/src/main/java/org/apache/iceberg/hive/HiveSchemaConverter.java","lineNumber":129,"sourceCode":"            return Types.StringType.get();\n          case STRING:\n            return Types.StringType.get();\n          case TIMESTAMP:\n            return Types.TimestampType.withoutZone();\n          case DATE:\n            return Types.DateType.get();\n          case DECIMAL:\n            DecimalTypeInfo decimalTypeInfo = (DecimalTypeInfo) typeInfo;\n            return Types.DecimalType.of(decimalTypeInfo.precision(), decimalTypeInfo.scale());\n          case INTERVAL_YEAR_MONTH:\n          case INTERVAL_DAY_TIME:\n          default:\n            // special case for Timestamp with Local TZ which is only available in Hive3\n            if (\"TIMESTAMPLOCALTZ\"\n                .equalsIgnoreCase(((PrimitiveTypeInfo) typeInfo).getPrimitiveCategory().name())) {\n              return Types.TimestampType.withZone();\n            }\n            throw new IllegalArgumentException(\n                \"Unsupported Hive type (\"\n                    + ((PrimitiveTypeInfo) typeInfo).getPrimitiveCategory()\n                    + \") for Iceberg tables.\");\n        }\n      case STRUCT:\n        StructTypeInfo structTypeInfo = (StructTypeInfo) typeInfo;\n        List<Types.NestedField> fields =\n            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++;","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/hive-metastore/src/main/java/org/apache/iceberg/hive/HiveSchemaConverter.java#L111-L147","documentation":"HiveSchemaConverter.convertType throws IllegalArgumentException when it meets a Hive primitive type category that has no Iceberg type mapping (anything not handled by the switch and not TIMESTAMPLOCALTZ). Iceberg cannot represent that primitive type in its schema, so schema conversion from Hive fails immediately.","triggerScenarios":"Converting a Hive table schema containing an unmapped primitive (e.g. DECIMAL outside supported bounds is mapped elsewhere; typically exotic or hive3-only categories) via HiveSchemaConverter.convert on a StructTypeInfo field.","commonSituations":"Migrating legacy Hive tables to Iceberg with types like BINARY variants or vendor-specific categories; Hive2/Hive3 metastore differences (e.g. TIMESTAMP WITH LOCAL TIME ZONE handled only as the TIMESTAMPLOCALTZ special case); schemas created by other tools with unsupported primitives.","solutions":["Alter the Hive column to a supported type (string, int, bigint, double, boolean, date, timestamp, decimal, binary-compatible) before converting.","Add an explicit case in HiveSchemaConverter for the category if it has a sensible Iceberg mapping.","Exclude/transform the offending column during migration and recreate it as a supported Iceberg type."],"exampleFix":"// before\n-- column 'tz' is timestamp with local time zone on an older metastore\n// after\nALTER TABLE events CHANGE COLUMN tz tz timestamp; -- or upgrade to Hive3 so TIMESTAMPLOCALTZ maps to timestamptz","handlingStrategy":"validation","validationCode":"for (TypeInfo ti : hiveSchema.getAllStructFieldTypeInfo()) { if (((PrimitiveTypeInfo) ti).getPrimitiveCategory() == PrimitiveCategory.UNKNOWN) throw new IllegalStateException(\"unsupported primitive\"); }","typeGuard":null,"tryCatchPattern":"try { schema = HiveSchemaConverter.convert(hiveSchema); } catch (IllegalArgumentException e) { /* pre-map offending columns */ }","preventionTips":["Audit Hive schemas for exotic primitives before migration.","Standardize on Hive3 when TIMESTAMPLOCALTZ is needed.","Maintain a Hive-to-Iceberg type mapping checklist."],"tags":["schema-conversion","unsupported-type","hive"],"backgroundTag":"unsupported-enum-value","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"}