{"record":{"id":"970db9ac180c3596","repo":"apache/iceberg","slug":"unsupported-element-type-elementtype-970db9","errorCode":null,"errorMessage":"Unsupported element type: ${elementType}","messagePattern":"Unsupported element type: (.+?)","errorType":"exception","errorClass":"java.lang.UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/data/StructRowData.java","lineNumber":341,"sourceCode":"            array[index] = convertValue(elementType.asListType().elementType(), element);\n          }\n\n          index += 1;\n        }\n        return new GenericArrayData(array);\n      case MAP:\n        Types.MapType mapType = elementType.asMapType();\n        Set<? extends Map.Entry<?, ?>> entries = ((Map<?, ?>) value).entrySet();\n        Map<Object, Object> result = Maps.newHashMap();\n        for (Map.Entry<?, ?> entry : entries) {\n          final Object keyValue = convertValue(mapType.keyType(), entry.getKey());\n          final Object valueValue = convertValue(mapType.valueType(), entry.getValue());\n          result.put(keyValue, valueValue);\n        }\n\n        return new GenericMapData(result);\n      default:\n        throw new UnsupportedOperationException(\"Unsupported element type: \" + elementType);\n    }\n  }\n}\n","sourceCodeStart":323,"sourceCodeEnd":345,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/data/StructRowData.java#L323-L345","documentation":"StructRowData.convertValue recursively converts Iceberg types to Flink RowData values; the default switch branch rejects any Iceberg type it cannot map for array/map elements. This UnsupportedOperationException signals an unmapped or unsupported element type in the schema.","triggerScenarios":"Building a StructRowData over a RowType containing an array/map whose element type falls into the switch's default branch (e.g. VARIANT or other unmapped types) and iterating its values.","commonSituations":"Reading tables containing newer Iceberg types (variant, unknown types) with a Flink reader that predates support for them.","solutions":["Upgrade the iceberg-flink runtime to a version supporting the element type in question","Rewrite the schema to use only supported element types, or cast the column","Handle the field client-side by reading it as binary/string instead of typed array/map"],"exampleFix":"// before\nTypes.NestedField field = schema.caseInsensitiveField(\"variants\"); // VARIANT in ARRAY\n// after\nfield = schema.caseInsensitiveField(\"variants\"); // read as string/binary until VARIANT arrays supported","handlingStrategy":"type-guard","validationCode":"RowType.FieldType f = rowType.getTypeAt(i);\nif (f instanceof org.apache.flink.table.types.logical.ArrayType a) {\n  LogicalType el = a.getElementType(); // verify el is in supported set\n}","typeGuard":"boolean isSupportedElementType(LogicalType t) {\n  switch (t.getTypeRoot()) {\n    case BOOLEAN: case INTEGER: case BIGINT: case DOUBLE: case VARCHAR:\n    case BINARY: case VARBINARY: case TIMESTAMP_WITHOUT_TIME_ZONE: return true;\n    default: return false;\n  }\n}","tryCatchPattern":"try { ArrayData arr = row.getArray(pos); }\ncatch (UnsupportedOperationException e) { /* handle unsupported element type: read column as string */ }","preventionTips":["Keep table schemas within Flink-supported Iceberg types","Upgrade iceberg-flink before introducing new logical types to tables","Test read paths against tables containing variant/newer types"],"tags":["flink","unsupported-type","schema"],"backgroundTag":"unsupported-operation","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}