apache/iceberg · error · java.lang.UnsupportedOperationException
Cannot set row kind in the RowDataProjection
Error message
Cannot set row kind in the RowDataProjection
What it means
RowDataProjection wraps an inner RowData and projects it to a subset of fields. Setting the row kind on a projection is not a meaningful operation, so setRowKind unconditionally throws UnsupportedOperationException. This is an intentionally unsupported mutating method on a read-only projection view.
Solutions
- Wrap the projected row in a copy (e.g. GenericRowData) and set the kind on that copy
- Use a BinaryRowData/JoinedRowData wrapper that supports row kind
- Apply the row-kind change upstream, before or after projection, on your own RowData
Example fix
// before projected.setRowKind(RowKind.DELETE); // throws // after GenericRowData copy = new GenericRowData(projected.getArity()); for (int i = 0; i < projected.getArity(); i++) copy.setField(i, RowData.createFieldGetter(...).getFieldOrNull(projected)); copy.setRowKind(RowKind.DELETE);
Defensive patterns
Strategy: fallback
Type guard
RowData mutable = (projected instanceof RowDataProjection) ? copyOf(projected) : projected;
Try / catch
try { row.setRowKind(kind); } catch (UnsupportedOperationException e) { GenericRowData copy = copyToGenericRowData(row); copy.setRowKind(kind); emit(copy); } Prevention
- Treat RowDataProjection as read-only
- Copy to GenericRowData before mutating row kind
- Don't pass projections directly to sinks that mutate row kind
When it happens
Trigger: Calling setRowKind(...) on a RowDataProjection instance obtained from Iceberg's Flink source/scan pipeline (e.g. attempting to mark a projected row as INSERT/DELETE before emitting to a sink).
Common situations: Custom Flink operators or sinks that assume any RowData is mutable and call setRowKind; UDFs that re-tag rows downstream of the Iceberg reader.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Cannot set row kind in the RowDataProjection
- Cannot set row kind in the RowDataProjection
- Cannot set row kind in the RowDataProjection
- Could not set a field in the RowDataWrapper because rowData…
- Could not set a field in the RowDataWrapper because rowData…
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/b5c95f48f868517f.
Report an issue: GitHub.
Appendix: source
Thrown at flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/data/RowDataProjection.java:198
private Object getValue(int pos) {
Preconditions.checkState(rowData != null, "Row data not wrapped");
return getters[pos].getFieldOrNull(rowData);
}
@Override
public int getArity() {
return getters.length;
}
@Override
public RowKind getRowKind() {
Preconditions.checkState(rowData != null, "Row data not wrapped");
return rowData.getRowKind();
}
@Override
public void setRowKind(RowKind kind) {
throw new UnsupportedOperationException("Cannot set row kind in the RowDataProjection");
}
@Override
public boolean isNullAt(int pos) {
return getValue(pos) == null;
}
@Override
public boolean getBoolean(int pos) {
return (boolean) getValue(pos);
}
@Override
public byte getByte(int pos) {
return (byte) getValue(pos);
}
@OverrideView on GitHub (pinned to 86d9c8fc54)