apache/iceberg · error · 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'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.
Source
Thrown at flink/v2.2/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, 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.
Example fix
// before Schema s = new Schema(required(1, "f", Types.StringType.get())); // ORC column is double // after Schema s = new Schema(required(1, "f", Types.DoubleType.get())); // matches ORC type
Defensive patterns
Strategy: validation
Validate before calling
// check Iceberg type matches ORC physical type before reading
if (icebergType.typeId() != expectedIdFor(orcType)) {
throw new IllegalStateException("Iceberg/ORC type mismatch on column " + field);
} Type guard
boolean matchesOrc(Type.PrimitiveType p, OrcProto.Type orc) { return ORC_KIND_BY_ICEBERG.get(p.typeId()) == orc.getKind(); } Try / catch
try { reader.read(...); } catch (IllegalArgumentException e) { /* realign schema or rewrite files */ } Prevention
- 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
When it happens
Trigger: 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).
Common situations: ORC files written outside Iceberg with mismatched types; schema evolution mismatched the file's physical types; corrupt/mismatched ORC metadata.
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 ORC type %s
- Invalid iceberg type %s corresponding to Flink logical type
- Invalid iceberg type %s corresponding to Flink logical type
- Invalid iceberg type %s corresponding to ORC type %s
- Invalid precision: ${precision}
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/55f2b9793dc531d0.
Report an issue: GitHub.