apache/iceberg · error · UnsupportedOperationException

Unsupported element type:

Error message

Unsupported element type: 

What it means

StructRowData.convertValue maps Iceberg values to Flink container types and its switch covers primitive types, strings, records (RowData), arrays (GenericArrayData), and maps (GenericMapData). The default branch throws UnsupportedOperationException for any other element type, meaning the Iceberg type has no conversion case.

Source

Thrown at flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/data/StructRowData.java:341

            array[index] = convertValue(elementType.asListType().elementType(), element);
          }

          index += 1;
        }
        return new GenericArrayData(array);
      case MAP:
        Types.MapType mapType = elementType.asMapType();
        Set<? extends Map.Entry<?, ?>> entries = ((Map<?, ?>) value).entrySet();
        Map<Object, Object> result = Maps.newHashMap();
        for (Map.Entry<?, ?> entry : entries) {
          final Object keyValue = convertValue(mapType.keyType(), entry.getKey());
          final Object valueValue = convertValue(mapType.valueType(), entry.getValue());
          result.put(keyValue, valueValue);
        }

        return new GenericMapData(result);
      default:
        throw new UnsupportedOperationException("Unsupported element type: " + elementType);
    }
  }
}

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Upgrade the Iceberg Flink runtime to a version whose StructRowData handles the type shown in the message.
  2. Avoid selecting unsupported columns (e.g. Variant) in Flink reads, or project around them.
  3. Convert the unsupported type via an explicit SQL cast/expression to a supported type in the Flink job.

Example fix

// before: selecting variant column directly
SELECT my_variant FROM iceberg_table

// after: cast or drop the unsupported column
SELECT CAST(CAST(my_variant AS STRING) AS STRING) AS my_variant FROM iceberg_table
Defensive patterns

Strategy: validation

Validate before calling

Types.StructType struct = schema.asStruct();
for (Types.NestedField f : schema.columns()) {
  if (f.type().typeId() == Types.TypeID.VARIANT || f.type().typeId() == Types.TypeID.UNKNOWN) {
    throw new IllegalArgumentException("Column " + f.name() + " type not supported by Flink converter");
  }
}

Try / catch

try {
  RowData row = ...;
} catch (UnsupportedOperationException e) {
  // fall back: drop or cast the unsupported column in the read projection
}

Prevention

When it happens

Trigger: convertValue is invoked with an elementType not handled by the switch, e.g. Variant or another newer Iceberg type when converting nested array/map/list values.

Common situations: Reading tables containing Variant or other newly added Iceberg types from Flink 2.3 jobs; nested arrays/maps of types the converter was not updated to handle.

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