apache/iceberg · error · UnsupportedOperationException

Unsupported element type

Error message

Unsupported element type: ${elementType}

What it means

StructRowData.convertValue recursively converts Iceberg field values into Flink ArrayData/MapData-compatible objects. The default branch means a LogicalType of a nested element was not one of the handled types (primitives, VARCHAR, TIMESTAMP, ARRAY, MAP, ROW, etc.), so the adapter cannot interpret the stored value and throws UnsupportedOperationException.

Solutions

  1. Check the elementType in the message against the supported types in convertValue and avoid/normalize that nested type in the schema if possible.
  2. Upgrade the iceberg-flink runtime module to a version that handles the nested element type.
  3. If the type should be supported, add a case to convertValue mirroring the existing conversion pattern for the missing LogicalType.

Example fix

// before
default:
  throw new UnsupportedOperationException("Unsupported element type: " + elementType);
// after
case TIMESTAMP_WITHOUT_TIME_ZONE:
  return TimestampData.fromEpochMillis(...);
default:
  throw new UnsupportedOperationException("Unsupported element type: " + elementType);
Defensive patterns

Strategy: validation

Validate before calling

// validate schema before reading
RowType rowType = FlinkSchemaUtil.convert(table.schema());
rowType.getFields().forEach(f -> checkSupportedNested(f.getType()));

Type guard

boolean isConvertible(LogicalType t) { return t instanceof IntType || t instanceof BigIntType || t instanceof VarCharType || t instanceof TimestampType || t instanceof RowType || t instanceof ArrayType || t instanceof MapType; }

Try / catch

try { return rowData.getArray(pos); } catch (UnsupportedOperationException e) { log.error("Nested element type unsupported: {}", e.getMessage()); throw e; }

Prevention

When it happens

Trigger: Reading an Iceberg table whose nested array/map element type maps to a Flink LogicalType not handled by convertValue (e.g. a newly added or exotic logical type) via getArray/getMap on StructRowData.

Common situations: New Iceberg/Flink type support (e.g. nanosecond timestamps or variant types) used with an older flink runtime adapter that lacks the case; nested types inside array/map columns.

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

Appendix: source

Thrown at flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/data/StructRowData.java:335

            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)