apache/iceberg · error · java.lang.UnsupportedOperationException

Not a supported type:

Error message

Not a supported type: 

What it means

FlinkVariantShreddingAnalyzer.extractVariantValues walks Flink RowData looking for variant values. When a column marked as variant contains an object whose class is neither the expected BinaryVariant (backed by metadata+value byte buffers) nor another recognized variant representation, it throws UnsupportedOperationException naming the unexpected class.

Source

Thrown at flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/data/FlinkVariantShreddingAnalyzer.java:58

  protected List<VariantValue> extractVariantValues(
      List<RowData> bufferedRows, int variantFieldIndex) {
    List<VariantValue> values = Lists.newArrayList();

    for (RowData row : bufferedRows) {
      if (!row.isNullAt(variantFieldIndex)) {
        Variant flinkVariant = row.getVariant(variantFieldIndex);
        if (flinkVariant != null) {
          if (flinkVariant instanceof BinaryVariant binaryVariant) {
            VariantValue variantValue =
                VariantValue.from(
                    VariantMetadata.from(
                        ByteBuffer.wrap(binaryVariant.getMetadata())
                            .order(ByteOrder.LITTLE_ENDIAN)),
                    ByteBuffer.wrap(binaryVariant.getValue()).order(ByteOrder.LITTLE_ENDIAN));

            values.add(variantValue);
          } else {
            throw new UnsupportedOperationException(
                "Not a supported type: " + flinkVariant.getClass());
          }
        }
      }
    }

    return values;
  }

  @Override
  protected int resolveColumnIndex(RowType flinkSchema, String columnName) {
    return flinkSchema.getFieldIndex(columnName);
  }
}

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Align the iceberg-flink and Flink runtime versions so the variant value class is the expected BinaryVariant.
  2. Check where the RowData is produced and ensure variant fields are materialized as the Iceberg BinaryVariant representation.
  3. Extend extractVariantValues to handle the additional variant class if a new representation must be supported.

Example fix

// before
RowData field is a custom MyVariant object
// after
convert it to BinaryVariant(metadata, value) before running the shredding analyzer
Defensive patterns

Strategy: type-guard

Validate before calling

// java
if (!(flinkValue instanceof BinaryVariant)) {
  throw new IllegalArgumentException(
      "Variant field must be BinaryVariant, got " + flinkValue.getClass().getName());
}

Type guard

// java
if (flinkVariant instanceof BinaryVariant) {
  BinaryVariant bv = (BinaryVariant) flinkVariant;
  // safe to read bv.getMetadata()/bv.getValue()
}

Try / catch

// java
try {
  analyzer.analyze(dataStream);
} catch (UnsupportedOperationException e) {
  // inspect the class named in the message; align runtime versions
}

Prevention

When it happens

Trigger: Running variant shredding analysis over Flink data where a variant-typed field holds a FlinkVariant implementation other than BinaryVariant — e.g. a different internal variant wrapper class from a mismatched Flink/Iceberg version.

Common situations: Version skew between the Flink runtime and iceberg-flink runtime where the variant value class differs; custom RowData implementations supplying their own variant object; upstream connector producing an incompatible variant representation.

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