apache/iceberg · error · java.lang.UnsupportedOperationException

Unsupported NullType.

Error message

Unsupported NullType.

What it means

Flink NullType represents a column whose type is unknown/null (e.g. an untyped NULL literal). It has no Iceberg equivalent, so FlinkTypeVisitor throws UnsupportedOperationException when conversion reaches it. Iceberg requires every field to have a concrete type.

Source

Thrown at flink/v1.20/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)

Solutions

  1. Add an explicit cast to the null literal: SELECT CAST(NULL AS STRING) AS some_col.
  2. Declare the column with a concrete type in the Table API, e.g. DataTypes.STRING().nullable().
  3. Remove the always-null column from the sink schema or replace it with a typed default.
  4. Override visit(NullType) in a custom visitor if you want a specific default mapping.

Example fix

// before
INSERT INTO iceberg_t SELECT NULL AS note FROM src;
// after
INSERT INTO iceberg_t SELECT CAST(NULL AS STRING) AS note FROM src;
Defensive patterns

Strategy: validation

Validate before calling

import org.apache.flink.table.types.logical.LogicalType;
import org.apache.flink.table.types.logical.NullType;

static boolean containsNullType(org.apache.flink.table.api.Schema schema) {
  return schema.getColumns().stream()
      .anyMatch(c -> c.getType().getLogicalType() instanceof NullType);
}

Type guard

static boolean isNullType(LogicalType t) {
  return t instanceof NullType;
}

Prevention

When it happens

Trigger: Converting a row type containing a NULL literal column without an explicit cast (SELECT NULL AS c), or a connector emitting NullType columns, when the schema is converted via FlinkTypeVisitor for an Iceberg sink.

Common situations: INSERT INTO iceberg_table SELECT NULL AS some_col, ... where Flink infers NullType; UDFs returning untyped nulls; dynamic tables built from generic objects where a field type resolves to NullType.

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


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