{"record":{"id":"70690b27a4241469","repo":"apache/iceberg","slug":"invalid-iceberg-type-s-corresponding-to-orc-type-70690b","errorCode":null,"errorMessage":"Invalid iceberg type %s corresponding to ORC type %s","messagePattern":"Invalid iceberg type (.+?) corresponding to ORC type (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":500,"severity":"error","filePath":"orc/src/main/java/org/apache/iceberg/data/orc/GenericOrcReader.java","lineNumber":128,"sourceCode":"      }\n\n      switch (primitive.getCategory()) {\n        case BOOLEAN:\n          return OrcValueReaders.booleans();\n        case BYTE:\n          // Iceberg does not have a byte type. Use int\n        case SHORT:\n          // Iceberg does not have a short type. Use int\n        case INT:\n          return OrcValueReaders.ints();\n        case LONG:\n          switch (iPrimitive.typeId()) {\n            case TIME:\n              return GenericOrcReaders.times();\n            case LONG:\n              return OrcValueReaders.longs();\n            default:\n              throw new IllegalStateException(\n                  String.format(\n                      \"Invalid iceberg type %s corresponding to ORC type %s\",\n                      iPrimitive, primitive));\n          }\n\n        case FLOAT:\n          return OrcValueReaders.floats();\n        case DOUBLE:\n          return OrcValueReaders.doubles();\n        case DATE:\n          return GenericOrcReaders.dates();\n        case TIMESTAMP:\n          return GenericOrcReaders.timestamps();\n        case TIMESTAMP_INSTANT:\n          return GenericOrcReaders.timestampTzs();\n        case DECIMAL:\n          return GenericOrcReaders.decimals();\n        case CHAR:","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/orc/src/main/java/org/apache/iceberg/data/orc/GenericOrcReader.java#L110-L146","documentation":"GenericOrcReader.primitive() maps an Iceberg primitive type to an ORC value reader. Inside the ORC INT/long-compatible branch, a TIME or LONG Iceberg type is handled, but any other Iceberg primitive reaching that default arm is rejected with IllegalStateException because there is no valid reader mapping.","triggerScenarios":"Reading an ORC file whose column type maps to this switch arm while the Iceberg schema declares a primitive type not handled in that branch (type mismatch between the Iceberg schema and the ORC file written by another writer).","commonSituations":"Schema evolution mismatch; ORC files written by an older Iceberg version or third-party tool with types the reader doesn't expect; corrupted or hand-edited ORC type mappings.","solutions":["Align the Iceberg schema with the actual ORC file schema (update the table schema).","Rewrite the data files with a matching Iceberg type.","Upgrade Iceberg to a version handling the needed type mapping.","Inspect the ORC file schema (orc-tools) to identify the offending column and correct the mapping."],"exampleFix":"// before\nTypes.TimestampType ts = (Types.TimestampType) type; // treated as INT in ORC, hits default\n// after\nif (iPrimitive.typeId() == Types.TimestampType.class.asSubclass(...)) {\n  return GenericOrcReaders.timestamp(); // use the explicitly supported reader\n}","handlingStrategy":"validation","validationCode":"// verify schema type is supported before reading\nif (!SUPPORTED.get(iPrimitive.typeId())) throw new IllegalArgumentException(\"unsupported mapping for \" + iPrimitive);","typeGuard":"boolean isSupportedMapping = iPrimitive instanceof Types.LongType || iPrimitive instanceof Types.TimeType;","tryCatchPattern":null,"preventionTips":["Keep table schema in sync with ORC file schema","Use schema evolution APIs instead of hand edits","Test read paths after schema changes","Inspect ORC file schema with orc-tools before remapping"],"tags":["orc","reader","type-mismatch","schema"],"backgroundTag":"incompatible-source-type","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"}