{"record":{"id":"451d7c228de28e52","repo":"apache/iceberg","slug":"unhandled-type-primitive-451d7c","errorCode":null,"errorMessage":"Unhandled type {primitive}","messagePattern":"Unhandled type (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/data/SparkOrcReader.java","lineNumber":131,"sourceCode":"          return OrcValueReaders.floats();\n        case DOUBLE:\n          return OrcValueReaders.doubles();\n        case TIMESTAMP_INSTANT:\n        case TIMESTAMP:\n          return SparkOrcValueReaders.timestampTzs();\n        case DECIMAL:\n          return SparkOrcValueReaders.decimals(primitive.getPrecision(), primitive.getScale());\n        case CHAR:\n        case VARCHAR:\n        case STRING:\n          return SparkOrcValueReaders.utf8String();\n        case BINARY:\n          if (Type.TypeID.UUID == iPrimitive.typeId()) {\n            return SparkOrcValueReaders.uuids();\n          }\n          return OrcValueReaders.bytes();\n        default:\n          throw new IllegalArgumentException(\"Unhandled type \" + primitive);\n      }\n    }\n  }\n}\n","sourceCodeStart":113,"sourceCodeEnd":136,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/data/SparkOrcReader.java#L113-L136","documentation":"SparkOrcReader maps Iceberg types to ORC value readers. The default branch of primitive() throws IllegalArgumentException for ORC primitive types it has no reader for (outside the handled BOOLEAN, BYTE, SHORT, INT, LONG, FLOAT, DOUBLE, STRING, VARCHAR, CHAR, DECIMAL, TIMESTAMP, TIMESTAMP_INSTANT, DATE, BINARY cases). It signals an ORC file whose column type cannot be read into the requested Iceberg type.","triggerScenarios":"Reading an ORC file containing a primitive type not handled by the switch, e.g. uncommon ORC types like union or unsupported temporal variants, when mapping to the expected Iceberg type.","commonSituations":"ORC files written by other tools with unusual type usage; version mismatch where new ORC types exist but reader mapping is missing; type mapping mismatches during schema evolution.","solutions":["Upgrade Iceberg to a version with broader ORC type support","Rewrite/re-export the ORC file with supported types","Verify the expected Iceberg type matches the ORC column type","Cast the column to a supported type in the producing pipeline"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"for (TypeDescription child : orcFileSchema.getChildren()) {\n  if (child.getCategory().isPrimitive() && !SUPPORTED.contains(child.getCategory())) {\n    throw new IllegalStateException(\"ORC type not readable: \" + child);\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  CloseableIterable<SparkInternalRow> rows = reader.read();\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().startsWith(\"Unhandled type\")) { /* rewrite the ORC file or upgrade */ }\n  else throw e;\n}","preventionTips":["Write ORC files with standard ORC types","Keep Iceberg updated for new ORC category support","Validate Iceberg-to-ORC type mapping before bulk reads"],"tags":["spark","orc","reader","unsupported-type"],"backgroundTag":"invalid-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"}