{"record":{"id":"55f2b9793dc531d0","repo":"apache/iceberg","slug":"invalid-iceberg-type-s-corresponding-to-orc-type-55f2b9","errorCode":null,"errorMessage":"Invalid iceberg type %s corresponding to ORC type %s","messagePattern":"Invalid iceberg type (.+?) corresponding to ORC type (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink/v2.2/flink/src/main/java/org/apache/iceberg/flink/data/FlinkOrcReader.java","lineNumber":132,"sourceCode":"          }\n        case TIMESTAMP_NANO:\n          Types.TimestampNanoType timestampNanoType = (Types.TimestampNanoType) iPrimitive;\n          if (timestampNanoType.shouldAdjustToUTC()) {\n            return FlinkOrcReaders.timestampTzs();\n          } else {\n            return FlinkOrcReaders.timestamps();\n          }\n        case STRING:\n          return FlinkOrcReaders.strings();\n        case UUID:\n        case FIXED:\n        case BINARY:\n          return OrcValueReaders.bytes();\n        case DECIMAL:\n          Types.DecimalType decimalType = (Types.DecimalType) iPrimitive;\n          return FlinkOrcReaders.decimals(decimalType.precision(), decimalType.scale());\n        default:\n          throw new IllegalArgumentException(\n              String.format(\n                  \"Invalid iceberg type %s corresponding to ORC type %s\", iPrimitive, primitive));\n      }\n    }\n  }\n}\n","sourceCodeStart":114,"sourceCodeEnd":139,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v2.2/flink/src/main/java/org/apache/iceberg/flink/data/FlinkOrcReader.java#L114-L139","documentation":"FlinkOrcReader's visitor throws IllegalArgumentException('Invalid iceberg type %s corresponding to ORC type %s') when an Iceberg primitive cannot be matched to the corresponding ORC primitive during value reader construction — the Iceberg type and the ORC column type are incompatible or the Iceberg type is unmapped.","triggerScenarios":"Reading ORC files where the Iceberg schema's primitive for a column doesn't correspond to the ORC field type (e.g. Iceberg LongType against an ORC double, or an unmapped Iceberg primitive hitting default).","commonSituations":"ORC files written outside Iceberg with mismatched types; schema evolution mismatched the file's physical types; corrupt/mismatched ORC metadata.","solutions":["Align the Iceberg schema with the actual ORC file types, or rewrite the ORC files with matching types.","Use schema projection/naming consistent with the file's written schema (check table metadata snapshots).","Verify the file was written by Iceberg ORC writer; if not, import with correct type mapping."],"exampleFix":"// before\nSchema s = new Schema(required(1, \"f\", Types.StringType.get())); // ORC column is double\n// after\nSchema s = new Schema(required(1, \"f\", Types.DoubleType.get())); // matches ORC type","handlingStrategy":"validation","validationCode":"// check Iceberg type matches ORC physical type before reading\nif (icebergType.typeId() != expectedIdFor(orcType)) {\n  throw new IllegalStateException(\"Iceberg/ORC type mismatch on column \" + field);\n}","typeGuard":"boolean matchesOrc(Type.PrimitiveType p, OrcProto.Type orc) { return ORC_KIND_BY_ICEBERG.get(p.typeId()) == orc.getKind(); }","tryCatchPattern":"try { reader.read(...); } catch (IllegalArgumentException e) { /* realign schema or rewrite files */ }","preventionTips":["Import external ORC files with an explicit matching schema","Verify file types with ORC metadata tools before reads","Avoid schema overwrites that diverge from physical ORC types"],"tags":["flink","orc","type-mismatch"],"backgroundTag":"type-mismatch","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"}