apache/iceberg · error · java.lang.IllegalArgumentException
Invalid iceberg type %s corresponding to ORC type %s
Error message
Invalid iceberg type %s corresponding to ORC type %s
What it means
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.
Source
Thrown at flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/data/FlinkOrcReader.java:132
}
case TIMESTAMP_NANO:
Types.TimestampNanoType timestampNanoType = (Types.TimestampNanoType) iPrimitive;
if (timestampNanoType.shouldAdjustToUTC()) {
return FlinkOrcReaders.timestampTzs();
} else {
return FlinkOrcReaders.timestamps();
}
case STRING:
return FlinkOrcReaders.strings();
case UUID:
case FIXED:
case BINARY:
return OrcValueReaders.bytes();
case DECIMAL:
Types.DecimalType decimalType = (Types.DecimalType) iPrimitive;
return FlinkOrcReaders.decimals(decimalType.precision(), decimalType.scale());
default:
throw new IllegalArgumentException(
String.format(
"Invalid iceberg type %s corresponding to ORC type %s", iPrimitive, primitive));
}
}
}
}
View on GitHub (pinned to 86d9c8fc54)
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.
Example fix
// before // schema says DECIMAL(38,10), ORC file column is DOUBLE -> reader throws // after // fix schema or rewrite files so the ORC column type matches the Iceberg type
Defensive patterns
Strategy: validation
Validate before calling
// verify ORC physical types match the Iceberg schema before reading
Configuration conf = new Configuration();
Reader orcReader = OrcFile.createReader(path, OrcFile.readerOptions(conf));
orcReader.getSchema().getChildren().forEach(t ->
LOG.info("ORC column: {} {}", t.getCategory(), t.getTypeName())); Try / catch
try (CloseableIterable<RowData> rows = reader.read()) {
rows.forEach(r -> out.collect(r));
} catch (IllegalArgumentException e) {
if (e.getMessage().contains("Invalid iceberg type")) {
throw new IOException("ORC file types do not match table schema: " + e.getMessage(), e);
}
throw e;
} Prevention
- 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.
When it happens
Trigger: 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).
Common situations: 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.
Understand the failure class
Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.
Related errors
- Invalid iceberg type %s corresponding to Flink logical type
- Invalid iceberg type %s corresponding to ORC type %s
- Invalid iceberg type %s corresponding to Flink logical type
- Invalid iceberg type %s corresponding to ORC type %s
- Invalid iceberg type %s corresponding to ORC type %s
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/3a270bacd17efa02.
Report an issue: GitHub.