apache/iceberg · error · java.lang.UnsupportedOperationException
Unsupported NullType.
Error message
Unsupported NullType.
What it means
Type-visitor guard in FlinkTypeVisitor: a Flink NullType column reached schema traversal. NullType has no Iceberg counterpart in this conversion, so the visitor refuses it — the Flink DDL/schema contains a column with only the null type.
Solutions
- Add an explicit cast: CAST(NULL AS STRING) (or the target type) in the query.
- Declare a concrete column type in the DDL instead of relying on inferred NULL type.
- Subclass FlinkTypeVisitor and override visit(NullType) to map to a chosen default Iceberg type.
- Ensure upstream schema inference produces concrete types (e.g. via table schema definitions, not expression inference).
Example fix
// before INSERT INTO t SELECT NULL AS extra_col FROM src; // after INSERT INTO t SELECT CAST(NULL AS STRING) AS extra_col FROM src;
Defensive patterns
Strategy: validation
Validate before calling
for (Column col : resolvedSchema.getColumns()) {
if (col.getDataType().getLogicalType() instanceof NullType) {
throw new IllegalArgumentException("Column '" + col.getName() + "' is NULL-typed; declare a concrete type");
}
} Try / catch
try {
Schema s = FlinkSchemaUtil.toIcebergSchema(flinkSchema);
} catch (UnsupportedOperationException e) {
if (e.getMessage().contains("NullType")) {
// add CAST(NULL AS <type>) in the producing query
} else {
throw e;
}
} Prevention
- Always cast NULL literals to a concrete type in SELECT lists.
- Declare explicit column types in DDLs instead of relying on inference.
- Review dynamic schema-inference queries for pure-NULL expressions.
When it happens
Trigger: Schema conversion encountering a column or expression typed as NULL, e.g. 'CAST(NULL AS ...)' missing, or a table defined with a NULL-typed column, dispatching to visit(NullType).
Common situations: SELECT NULL AS col in an INSERT INTO Iceberg table without a cast; dynamically derived schemas from statements where all values are NULL.
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
- Unsupported DayTimeIntervalType.
- Unsupported DistinctType.
- Unsupported NullType.
- Unsupported RawType.
- Unsupported StructuredType.
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/543026f3173d664d.
Report an issue: GitHub.
Appendix: source
Thrown at flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/FlinkTypeVisitor.java:63
@Override
public T visit(DayTimeIntervalType dayTimeIntervalType) {
throw new UnsupportedOperationException("Unsupported DayTimeIntervalType.");
}
@Override
public T visit(DistinctType distinctType) {
throw new UnsupportedOperationException("Unsupported DistinctType.");
}
@Override
public T visit(StructuredType structuredType) {
throw new UnsupportedOperationException("Unsupported StructuredType.");
}
@Override
public T visit(NullType nullType) {
throw new UnsupportedOperationException("Unsupported NullType.");
}
@Override
public T visit(RawType<?> rawType) {
throw new UnsupportedOperationException("Unsupported RawType.");
}
@Override
public T visit(SymbolType<?> symbolType) {
throw new UnsupportedOperationException("Unsupported SymbolType.");
}
@Override
public T visit(LogicalType other) {
throw new UnsupportedOperationException("Unsupported type: " + other);
}
}
View on GitHub (pinned to 86d9c8fc54)