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
Guard in FlinkOrcReader.primitive: while mapping an ORC column reader, the Iceberg primitive type paired with the ORC type has no case in this switch (e.g. a timestamp_ntz, variant, or newly added primitive). The formatted message shows both the Iceberg and ORC types, pointing at the column whose type pair is unhandled.
Source
Thrown at flink/v2.3/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
- Upgrade iceberg-flink to a version whose FlinkOrcReader supports the type.
- Inspect the ORC file schema vs the Iceberg schema and align types (e.g. cast unsupported columns).
- Add a reader mapping for the missing primitive if you own a patched build.
Defensive patterns
Strategy: try-catch
Validate before calling
Types.NestedField f = schema.asStruct().field(name);
if (f != null && !ORC_SUPPORTED.contains(f.type().asPrimitiveType().typeId())) {
throw new IllegalArgumentException("Type not readable from ORC: " + f.type());
} Try / catch
try { reader = FlinkOrcReader.factory.create(icebergType, orcType); } catch (IllegalArgumentException e) { /* skip column or fail fast */ } Prevention
- Align Iceberg and ORC schemas before reading.
- Upgrade connector when tables use newer types.
- Validate projections against supported ORC readers.
When it happens
Trigger: Reading ORC files whose projected Iceberg schema contains a primitive unsupported by the reader switch (only known primitives like BINARY/DECIMAL etc. are handled at that branch).
Common situations: Tables with newer Iceberg types read by an older iceberg-flink runtime; mismatched ORC type tags produced by other writers.
Understand the failure class
Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.
Related errors
- Invalid iceberg type %s corresponding to Flink logical type
- Invalid precision:
- Invalid primary key '%s'. A primary key must not contain dup
- Invalid primary key '%s'. Column '%s' does not exist.
- Invalid primary key '%s'. Column '%s' is not a physical colu
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/ef9fd836e5b98dfc.
Report an issue: GitHub.