{"record":{"id":"0236a382ad948285","repo":"apache/iceberg","slug":"rawvalue-in-variant-column-is-not-supported-0236a3","errorCode":null,"errorMessage":"RawValue in Variant column is not supported.","messagePattern":"RawValue in Variant column is not supported\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"flink/v2.2/flink/src/main/java/org/apache/iceberg/flink/data/VariantRowDataWrapper.java","lineNumber":145,"sourceCode":"    Variant value = field(pos);\n    return isNull(value) ? null : StringData.fromString(value.getString());\n  }\n\n  @Override\n  public DecimalData getDecimal(int pos, int precision, int scale) {\n    Variant value = field(pos);\n    return isNull(value) ? null : DecimalData.fromBigDecimal(value.getDecimal(), precision, scale);\n  }\n\n  @Override\n  public TimestampData getTimestamp(int pos, int precision) {\n    Variant value = field(pos);\n    return isNull(value) ? null : timestampValue(value, precision);\n  }\n\n  @Override\n  public <T> RawValueData<T> getRawValue(int pos) {\n    throw new UnsupportedOperationException(\"RawValue in Variant column is not supported.\");\n  }\n\n  @Override\n  public byte[] getBinary(int pos) {\n    Variant value = field(pos);\n    return isNull(value) ? null : value.getBytes();\n  }\n\n  @Override\n  public ArrayData getArray(int pos) {\n    ArrayType arrayType = (ArrayType) rowType.getTypeAt(pos);\n    LogicalType elementType = arrayType.getElementType();\n    Variant arrayVariant = field(pos);\n    return arrayDataValue(arrayVariant, elementType);\n  }\n\n  @Override\n  public MapData getMap(int pos) {","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v2.2/flink/src/main/java/org/apache/iceberg/flink/data/VariantRowDataWrapper.java#L127-L163","documentation":"VariantRowDataWrapper adapts a single Flink Variant object into RowData shaped by a RowType. RawValueData access (getRawValue) has no meaning for a Variant-backed row, so it unconditionally throws UnsupportedOperationException('RawValue in Variant column is not supported.'). Callers must use the typed accessors instead.","triggerScenarios":"Calling getRawValue(pos) on a VariantRowDataWrapper obtained from wrapping a Variant (e.g. via VariantRowDataWrapper(rowType).wrap(variant)), typically from Flink operators or connector code using raw-value passthrough on rows read from Variant columns.","commonSituations":"Flink job code or a connector applying RawValueData optimization to rows surfaced from an Iceberg variant column; generic RowData helper utilities iterating all accessors; migrating code that used getRawValue on normal rows onto variant-backed rows.","solutions":["Replace getRawValue calls with typed accessors (getString/getBinary/getRow/getVariant) on the VariantRowDataWrapper.","Disable raw-value passthrough in the consuming Flink operator for variant-backed rows.","If passthrough is required, wrap the Variant itself into RawValueData at the source layer instead of reading through this wrapper.","Access the underlying Variant directly via getVariant(pos) and construct the value you need."],"exampleFix":"// before\nVariantPayload p = wrapper.getRawValue(pos).toObject(VariantPayload.class); // throws\n\n// after\nVariant v = wrapper.getVariant(pos);\nbyte[] bytes = v == null ? null : v.getBytes();","handlingStrategy":"type-guard","validationCode":"if (row instanceof VariantRowDataWrapper) {\n  throw new IllegalStateException(\"Use typed accessors or getVariant(), not getRawValue()\");\n}","typeGuard":"boolean supportsRawValues(RowData row) {\n  return !(row instanceof VariantRowDataWrapper);\n}","tryCatchPattern":"try {\n  RawValueData<?> rv = row.getRawValue(pos);\n} catch (UnsupportedOperationException e) {\n  if (e.getMessage().contains(\"RawValue in Variant column\")) {\n    Variant v = row.getVariant(pos); // typed fallback\n  } else {\n    throw e;\n  }\n}","preventionTips":["Access variant fields via getVariant/getBinary/getString instead of getRawValue.","Audit Flink operator configs for raw-value passthrough when sources may surface Variant columns."],"tags":["flink","variant","raw-value","not-implemented"],"backgroundTag":"method-not-implemented","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}