{"record":{"id":"8874c5b8b97de2e8","repo":"apache/iceberg","slug":"not-a-supported-type-flinkvariant-getclass","errorCode":null,"errorMessage":"Not a supported type: ${flinkVariant.getClass()}","messagePattern":"Not a supported type: (.+?)","errorType":"exception","errorClass":"java.lang.UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/data/FlinkVariantShreddingAnalyzer.java","lineNumber":58,"sourceCode":"  protected List<VariantValue> extractVariantValues(\n      List<RowData> bufferedRows, int variantFieldIndex) {\n    List<VariantValue> values = Lists.newArrayList();\n\n    for (RowData row : bufferedRows) {\n      if (!row.isNullAt(variantFieldIndex)) {\n        Variant flinkVariant = row.getVariant(variantFieldIndex);\n        if (flinkVariant != null) {\n          if (flinkVariant instanceof BinaryVariant binaryVariant) {\n            VariantValue variantValue =\n                VariantValue.from(\n                    VariantMetadata.from(\n                        ByteBuffer.wrap(binaryVariant.getMetadata())\n                            .order(ByteOrder.LITTLE_ENDIAN)),\n                    ByteBuffer.wrap(binaryVariant.getValue()).order(ByteOrder.LITTLE_ENDIAN));\n\n            values.add(variantValue);\n          } else {\n            throw new UnsupportedOperationException(\n                \"Not a supported type: \" + flinkVariant.getClass());\n          }\n        }\n      }\n    }\n\n    return values;\n  }\n\n  @Override\n  protected int resolveColumnIndex(RowType flinkSchema, String columnName) {\n    return flinkSchema.getFieldIndex(columnName);\n  }\n}\n","sourceCodeStart":40,"sourceCodeEnd":73,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/data/FlinkVariantShreddingAnalyzer.java#L40-L73","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Verify the column type is the Flink VariantFlinkType and values are the expected binary Variant class","Align Iceberg-flink runtime versions so the analyzer and value classes come from the same build","Convert the values to the supported binary Variant representation before analysis"],"exampleFix":"// before\nRow variantRow = ...; // passed raw struct into shredding analyzer\n// after\nVariantFlinkType t = (VariantFlinkType) fieldType;\nBinaryVariantValue v = ...; // expected class consumed by the analyzer","handlingStrategy":"type-guard","validationCode":"if (!(flinkVariant instanceof VariantValueRepresentation)) {\n  throw new IllegalArgumentException(\"Expected binary Flink Variant value, got: \" + flinkVariant.getClass());\n}","typeGuard":"boolean isSupportedVariant(Object v) { return v instanceof VariantBinaryValue; /* the binary variant class expected by the analyzer */ }","tryCatchPattern":"try { analyzer.extract(values); } catch (UnsupportedOperationException e) { if (e.getMessage().startsWith(\"Not a supported type\")) { /* convert to binary variant representation */ } else throw e; }","preventionTips":["Keep iceberg-flink and analyzer code from the same release","Verify column types are VariantFlinkType before shredding analysis","Add unit tests for variant input classes from all ingestion paths"],"tags":["flink","variant","shredding","unsupported-type"],"backgroundTag":"type-mismatch","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"}