{"record":{"id":"1cd075f8d8fdee29","repo":"apache/iceberg","slug":"not-a-supported-type-1cd075","errorCode":null,"errorMessage":"Not a supported type: ","messagePattern":"Not a supported type: ","errorType":"exception","errorClass":"java.lang.UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"flink/v2.3/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.3/flink/src/main/java/org/apache/iceberg/flink/data/FlinkVariantShreddingAnalyzer.java#L40-L73","documentation":"FlinkVariantShreddingAnalyzer.extractVariantValues walks Flink RowData looking for variant values. When a column marked as variant contains an object whose class is neither the expected BinaryVariant (backed by metadata+value byte buffers) nor another recognized variant representation, it throws UnsupportedOperationException naming the unexpected class.","triggerScenarios":"Running variant shredding analysis over Flink data where a variant-typed field holds a FlinkVariant implementation other than BinaryVariant — e.g. a different internal variant wrapper class from a mismatched Flink/Iceberg version.","commonSituations":"Version skew between the Flink runtime and iceberg-flink runtime where the variant value class differs; custom RowData implementations supplying their own variant object; upstream connector producing an incompatible variant representation.","solutions":["Align the iceberg-flink and Flink runtime versions so the variant value class is the expected BinaryVariant.","Check where the RowData is produced and ensure variant fields are materialized as the Iceberg BinaryVariant representation.","Extend extractVariantValues to handle the additional variant class if a new representation must be supported."],"exampleFix":"// before\nRowData field is a custom MyVariant object\n// after\nconvert it to BinaryVariant(metadata, value) before running the shredding analyzer","handlingStrategy":"type-guard","validationCode":"// java\nif (!(flinkValue instanceof BinaryVariant)) {\n  throw new IllegalArgumentException(\n      \"Variant field must be BinaryVariant, got \" + flinkValue.getClass().getName());\n}","typeGuard":"// java\nif (flinkVariant instanceof BinaryVariant) {\n  BinaryVariant bv = (BinaryVariant) flinkVariant;\n  // safe to read bv.getMetadata()/bv.getValue()\n}","tryCatchPattern":"// java\ntry {\n  analyzer.analyze(dataStream);\n} catch (UnsupportedOperationException e) {\n  // inspect the class named in the message; align runtime versions\n}","preventionTips":["Ensure variant fields are materialized as Iceberg BinaryVariant before shredding analysis.","Keep iceberg-flink and Flink versions compatible (variant class layout changed across versions).","Add an instanceof check early in pipelines that consume variant-typed columns."],"tags":["flink","variant","shredding","type-mismatch"],"backgroundTag":"incompatible-source-type","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T21:17:11.552Z"}