apache/iceberg · error · java.lang.IllegalArgumentException
Invalid iceberg type %s corresponding to Flink logical type
Error message
Invalid iceberg type %s corresponding to Flink logical type %s
What it means
FlinkOrcWriter.primitive() throws IllegalArgumentException 'Invalid iceberg type <type> corresponding to Flink logical type <type>' when an Iceberg primitive type cannot be mapped to an ORC writer for the given Flink logical type — the Iceberg type and Flink type pair is unsupported (mismatch between declared schema and Flink RowType).
Source
Thrown at flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/data/FlinkOrcWriter.java:165
}
case TIMESTAMP_NANO:
Types.TimestampNanoType timestampNanoType = (Types.TimestampNanoType) iPrimitive;
if (timestampNanoType.shouldAdjustToUTC()) {
return FlinkOrcWriters.timestampNanoTzs();
} else {
return FlinkOrcWriters.timestampNanos();
}
case STRING:
return FlinkOrcWriters.strings();
case UUID:
case FIXED:
case BINARY:
return GenericOrcWriters.byteArrays();
case DECIMAL:
Types.DecimalType decimalType = (Types.DecimalType) iPrimitive;
return FlinkOrcWriters.decimals(decimalType.precision(), decimalType.scale());
default:
throw new IllegalArgumentException(
String.format(
"Invalid iceberg type %s corresponding to Flink logical type %s",
iPrimitive, flinkPrimitive));
}
}
}
}
View on GitHub (pinned to 86d9c8fc54)
Solutions
- Ensure the Flink RowType is built from the Iceberg schema via FlinkSchemaUtil.convert(schema).
- Remove/retype columns producing unsupported pairs (check both types in the message).
- Use a different write format (Parquet/Avro) if the mapping exists there.
- Upgrade iceberg-flink if a newer version supports the pairing.
Example fix
// before RowType rowType = customRowType(); // not matching table schema // after RowType rowType = FlinkSchemaUtil.convert(table.schema());
Defensive patterns
Strategy: validation
Validate before calling
RowType rowType = FlinkSchemaUtil.convert(table.schema()); // derive Flink type from Iceberg schema, never hand-build
Try / catch
try {
writer.write(rowData);
} catch (IllegalArgumentException e) {
if (e.getMessage().contains("Invalid iceberg type")) {
LOG.error("Flink/Iceberg type pair unsupported: {}", e.getMessage());
}
throw e;
} Prevention
- Always derive Flink RowType via FlinkSchemaUtil.convert(schema).
- Check the supported Iceberg<->Flink type mapping table before using unusual types.
- Test writes on a sample table with the same schema before production.
When it happens
Trigger: Writing ORC files where a column's Iceberg primitive and Flink LogicalType don't form a supported pair (e.g. Iceberg BINARY paired with an unexpected Flink type, or a primitive combination with no branch in the switch).
Common situations: Custom FlinkRowType construction not derived from the Iceberg schema; writer framework upgrades changing type mappings; writing tables whose schema was transformed incorrectly.
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 ORC type %s
- 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 precision: ${precision}
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/069f3f96c7c48f64.
Report an issue: GitHub.