{"record":{"id":"50f27a09c931f204","repo":"apache/iceberg","slug":"unhandled-type","errorCode":null,"errorMessage":"Unhandled type ","messagePattern":"Unhandled type ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":400,"severity":"error","filePath":"orc/src/main/java/org/apache/iceberg/data/orc/GenericOrcReader.java","lineNumber":165,"sourceCode":"        case VARCHAR:\n        case STRING:\n          return GenericOrcReaders.strings();\n        case BINARY:\n          switch (iPrimitive.typeId()) {\n            case UUID:\n              return GenericOrcReaders.uuids();\n            case FIXED:\n              return OrcValueReaders.bytes();\n            case BINARY:\n              return GenericOrcReaders.bytes();\n            default:\n              throw new IllegalStateException(\n                  String.format(\n                      \"Invalid iceberg type %s corresponding to ORC type %s\",\n                      iPrimitive, primitive));\n          }\n        default:\n          throw new IllegalArgumentException(\"Unhandled type \" + primitive);\n      }\n    }\n  }\n}\n","sourceCodeStart":147,"sourceCodeEnd":170,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/orc/src/main/java/org/apache/iceberg/data/orc/GenericOrcReader.java#L147-L170","documentation":"GenericOrcReader.primitive() throws IllegalArgumentException with \"Unhandled type \" when the ORC file's primitive column category is not one of the categories the reader supports (e.g., an exotic ORC type or union). It is a defensive fallback for ORC types with no Iceberg reader mapping.","triggerScenarios":"Scanning ORC files containing column types outside the supported set (e.g., ORC UNION, unsupported categories) via Iceberg's generic ORC reader.","commonSituations":"ORC files written by non-Iceberg tools with exotic types; ORC files with union or complex columns where a primitive was expected; corrupt type metadata.","solutions":["Rewrite the ORC files with supported column types (remove/flatten exotic types).","Convert the files to a format/type combination Iceberg supports (e.g., rewrite via Spark).","Upgrade Iceberg to check for expanded ORC type support.","Inspect the file schema with orc-tools to identify the unsupported category."],"exampleFix":"// before\nSELECT * FROM iceberg_orc_table -- file has ORC UNION column -> Unhandled type\n// after\nALTER/rewrite: cast the union column to a supported primitive and rewrite files","handlingStrategy":"try-catch","validationCode":"// check ORC category support before scanning\nSet<String> supported = Set.of(\"BOOLEAN\",\"BYTE\",\"SHORT\",\"INT\",\"LONG\",\"FLOAT\",\"DOUBLE\",\"STRING\",\"VARCHAR\",\"CHAR\",\"BINARY\",\"DECIMAL\",\"DATE\",\"TIMESTAMP\");\nif (!supported.contains(orcPrimitive.getCategory().getName())) { /* rewrite file */ }","typeGuard":null,"tryCatchPattern":"try { reader.read(...); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith(\"Unhandled type\")) { /* rewrite/convert file */ } throw e; }","preventionTips":["Avoid exotic ORC types (UNION etc.) in Iceberg tables","Write files via Iceberg writers only","Validate third-party ORC files before registering","Upgrade Iceberg when using new types"],"tags":["orc","reader","unsupported-type","schema"],"backgroundTag":"unsupported-operation","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}