{"record":{"id":"939459d75d85ed5f","repo":"apache/iceberg","slug":"unsupported-element-type-elementtype-939459","errorCode":null,"errorMessage":"Unsupported element type: \" + elementType","messagePattern":"Unsupported element type: \" \\+ elementType","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"flink/v2.2/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.2/flink/src/main/java/org/apache/iceberg/flink/data/StructRowData.java#L323-L345","documentation":"StructRowData.convertValue maps Iceberg StructLike values into Flink data structures according to the Iceberg element type. Its switch covers all standard Iceberg types but has a default branch that throws UnsupportedOperationException('Unsupported element type: ' + elementType) when the type id isn't handled (or when a value doesn't match the expected shape, e.g. a non-Long reaching the TIMESTAMP cast path).","triggerScenarios":"Reading a list/map field via StructRowData.getArray/getMap whose element or key/value type falls through the switch (e.g. VARIANT or other newly added Iceberg types), or a nested timestamp value whose runtime type is neither LocalDateTime, OffsetDateTime, nor Long (causing the (Long) cast inside convertValue to precede this throw).","commonSituations":"Tables using newer Iceberg types (Variant, Unknown) read through the Flink adapter; nested timestamp columns where custom writers stored unexpected types; version mismatch between writer and reader on newly introduced type ids.","solutions":["Check which elementType is printed in the message; if it's a newer Iceberg type (e.g. variant), upgrade iceberg-flink to a version whose convertValue supports it.","Remove or project out the unsupported nested column type before reading via the Flink adapter.","For nested timestamp fields, ensure stored values are Long, LocalDateTime, or OffsetDateTime matching the column type.","If you own the code, extend convertValue's switch to map the new type id to its Flink equivalent."],"exampleFix":"// before\nArrayData arr = structRowData.getArray(pos); // fails for VARIANT elements\n\n// after\nTypes.NestedField field = schema.findField(\"myList\");\nPreconditions.checkArgument(\n    field.type().asListType().elementType().typeId() != Type.TypeID.VARIANT,\n    \"VARIANT list elements are not supported by StructRowData\");\nArrayData arr = structRowData.getArray(pos);","handlingStrategy":"validation","validationCode":"Type elemType = field.type().asListType().elementType();\nSet<Type.TypeID> supported = Set.of(Type.TypeID.BOOLEAN, Type.TypeID.INTEGER, Type.TypeID.DATE,\n    Type.TypeID.TIME, Type.TypeID.LONG, Type.TypeID.FLOAT, Type.TypeID.DOUBLE, Type.TypeID.DECIMAL,\n    Type.TypeID.TIMESTAMP, Type.TypeID.TIMESTAMP_NANO, Type.TypeID.STRING, Type.TypeID.FIXED,\n    Type.TypeID.BINARY, Type.TypeID.STRUCT, Type.TypeID.LIST, Type.TypeID.MAP);\nPreconditions.checkArgument(supported.contains(elemType.typeId()),\n    \"Element type not supported by StructRowData: %s\", elemType);","typeGuard":"boolean isConvertibleIcebergType(Type t) {\n  switch (t.typeId()) {\n    case VARIANT:\n    case UNKNOWN:\n      return false;\n    default:\n      return true;\n  }\n}","tryCatchPattern":"try {\n  ArrayData arr = structRowData.getArray(pos);\n} catch (UnsupportedOperationException e) {\n  if (e.getMessage().startsWith(\"Unsupported element type:\")) {\n    log.error(\"Nested type not supported by Flink reader: {}\", e.getMessage());\n    throw new UnsupportedColumnTypeException(e);\n  }\n  throw e;\n}","preventionTips":["Check nested list/map element types (e.g. VARIANT) before running Flink reads; project them out if unsupported.","Upgrade iceberg-flink when the table uses newly introduced Iceberg types."],"tags":["flink","nested-types","unsupported-type","conversion"],"backgroundTag":"unsupported-dtype","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"}