apache/iceberg · error · java.lang.UnsupportedOperationException

Unsupported RawType.

Error message

Unsupported RawType.

What it means

FlinkTypeVisitor throws UnsupportedOperationException for RawType, Flink's RAW type for arbitrary serialized objects with a type serializer. Iceberg has no opaque raw-object type, so conversion is rejected.

Solutions

  1. Convert the object to a serializable representation: Iceberg-compatible struct, string (e.g. JSON), or bytes.
  2. Declare the column as VARBINARY/BYTES or STRING and serialize the object explicitly.
  3. Keep RAW objects out of the table schema; store them in Flink state instead.
  4. Subclass FlinkTypeVisitor and override visit(RawType) with a custom mapping.

Example fix

// before
col 'payload' RAW('com.example.Payload', 'com.example.PayloadSerializer')

// after
col 'payload' BYTES  -- serialize explicitly before writing
Defensive patterns

Strategy: validation

Validate before calling

for (Column col : resolvedSchema.getColumns()) {
  if (col.getDataType().getLogicalType() instanceof RawType) {
    throw new IllegalArgumentException("Column '" + col.getName() + "' is RAW; use BYTES or STRING with explicit serialization");
  }
}

Try / catch

try {
  Schema s = FlinkSchemaUtil.toIcebergSchema(flinkSchema);
} catch (UnsupportedOperationException e) {
  if (e.getMessage().contains("RawType")) {
    // serialize objects to BYTES/STRING before persisting
  } else {
    throw e;
  }
}

Prevention

When it happens

Trigger: Schema conversion encountering a RAW('class', 'serializer') column, dispatching to visit(RawType).

Common situations: Passing Java/Scala objects through Flink pipelines using RAW columns; user-defined aggregations or state carried as RAW columns in Iceberg-backed tables.

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/cac0bd8bc5938830. Report an issue: GitHub.

Appendix: source

Thrown at flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/FlinkTypeVisitor.java:68

  @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)