apache/iceberg · error · UnsupportedOperationException

Unsupported NullType.

Error message

Unsupported NullType.

What it means

FlinkTypeVisitor.visit(NullType) throws UnsupportedOperationException because Iceberg schemas have no NULL-typed column. Flink's NULL type (from untyped NULL literals or unresolved casts) cannot map to any Iceberg type.

Solutions

  1. Add an explicit cast: `CAST(NULL AS STRING)` (or the intended concrete type).
  2. Declare the column with a concrete type in the DDL instead of relying on inference.
  3. Ensure UDFs declare concrete result types (getResultType / DataType hints).

Example fix

// before
INSERT INTO t SELECT NULL AS flag FROM src;
// after
INSERT INTO t SELECT CAST(NULL AS BOOLEAN) AS flag FROM src;
Defensive patterns

Strategy: type-guard

Validate before calling

if (dataType.getLogicalType() instanceof NullType) {
  throw new IllegalArgumentException("Cast NULL literals to a concrete type before Iceberg write");
}

Prevention

When it happens

Trigger: Converting a schema where a column's DataType is the NULL type — commonly from `CAST(NULL AS ...)` without a target type, untyped UDF results, or `NULL` literals in a VALUES/table definition.

Common situations: Pipelines inserting constant NULL columns into Iceberg sinks without explicit casts; schema inference producing NullType for empty/unknown sources.

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


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/33afa8b76eac7403. Report an issue: GitHub.

Appendix: source

Thrown at flink/v2.2/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)