apache/iceberg · error · java.lang.UnsupportedOperationException

Not a supported type: ${flinkVariant.getClass()}

Error message

Not a supported type: ${flinkVariant.getClass()}

What it means

FlinkVariantShreddingAnalyzer.extractVariantValues accepts Flink Variant values only as the expected binary Variant type (VariantFlinkType carrying metadata/value binary buffers). If the object is a Flink Variant value of any other class, the analyzer throws this UnsupportedOperationException. It indicates the input column is not the supported Flink Variant representation.

Source

Thrown at flink/v2.1/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. Verify the column type is the Flink VariantFlinkType and values are the expected binary Variant class
  2. Align Iceberg-flink runtime versions so the analyzer and value classes come from the same build
  3. Convert the values to the supported binary Variant representation before analysis

Example fix

// before
Row variantRow = ...; // passed raw struct into shredding analyzer
// after
VariantFlinkType t = (VariantFlinkType) fieldType;
BinaryVariantValue v = ...; // expected class consumed by the analyzer
Defensive patterns

Strategy: type-guard

Validate before calling

if (!(flinkVariant instanceof VariantValueRepresentation)) {
  throw new IllegalArgumentException("Expected binary Flink Variant value, got: " + flinkVariant.getClass());
}

Type guard

boolean isSupportedVariant(Object v) { return v instanceof VariantBinaryValue; /* the binary variant class expected by the analyzer */ }

Try / catch

try { analyzer.extract(values); } catch (UnsupportedOperationException e) { if (e.getMessage().startsWith("Not a supported type")) { /* convert to binary variant representation */ } else throw e; }

Prevention

When it happens

Trigger: Calling variant shredding analysis on a column whose values are not instances of the expected binary Variant class (e.g. a struct or string masquerading as a variant, or a different Iceberg/Flink Variant wrapper class).

Common situations: Mixed-version setups where the Flink Variant value class differs from the one the analyzer expects; incorrect table scan projection returning raw struct instead of Variant; custom Variant implementations.

Understand the failure class

Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.

Related errors


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