{"record":{"id":"3a270bacd17efa02","repo":"apache/iceberg","slug":"invalid-iceberg-type-s-corresponding-to-orc-type-3a270b","errorCode":null,"errorMessage":"Invalid iceberg type %s corresponding to ORC type %s","messagePattern":"Invalid iceberg type (.+?) corresponding to ORC type (.+?)","errorType":"exception","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink/v2.1/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.1/flink/src/main/java/org/apache/iceberg/flink/data/FlinkOrcReader.java#L114-L139","documentation":"FlinkOrcReader.primitive() throws IllegalArgumentException 'Invalid iceberg type <type> corresponding to ORC type <type>' when the combination of an Iceberg primitive type and the actual ORC column type is not supported by the reader — typically a mismatch between the declared Iceberg schema and the physical ORC type on disk.","triggerScenarios":"Reading ORC files where the ORC primitive type for a column does not match any supported pairing for the Iceberg primitive in the schema (e.g. an Iceberg DECIMAL column whose ORC type is not ORC decimal, or an unexpected primitive/physical combo).","commonSituations":"ORC files written by other tools with divergent type mappings; schema evolution changing an Iceberg type without rewriting ORC files; wrong table metadata pointing at foreign ORC files.","solutions":["Align the Iceberg schema with the actual ORC file types (check with orc-tools `meta`).","Rewrite the ORC files with the correct Iceberg types (rewrite_data_files action).","If files were written by external tools, register/import them with a matching schema.","Upgrade iceberg-flink in case the type pairing gained support in newer versions."],"exampleFix":"// before\n// schema says DECIMAL(38,10), ORC file column is DOUBLE -> reader throws\n// after\n// fix schema or rewrite files so the ORC column type matches the Iceberg type","handlingStrategy":"validation","validationCode":"// verify ORC physical types match the Iceberg schema before reading\nConfiguration conf = new Configuration();\nReader orcReader = OrcFile.createReader(path, OrcFile.readerOptions(conf));\norcReader.getSchema().getChildren().forEach(t ->\n    LOG.info(\"ORC column: {} {}\", t.getCategory(), t.getTypeName()));","typeGuard":null,"tryCatchPattern":"try (CloseableIterable<RowData> rows = reader.read()) {\n  rows.forEach(r -> out.collect(r));\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().contains(\"Invalid iceberg type\")) {\n    throw new IOException(\"ORC file types do not match table schema: \" + e.getMessage(), e);\n  }\n  throw e;\n}","preventionTips":["Never point an Iceberg table at externally written ORC files without matching schemas.","Rewrite files after Iceberg schema type changes.","Inspect ORC file schemas with orc-tools meta."],"tags":["flink","orc","reader","type-mismatch"],"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"}