{"record":{"id":"1850688dd3f086a0","repo":"apache/iceberg","slug":"variant-is-not-supported-185068","errorCode":null,"errorMessage":"Variant is not supported","messagePattern":"Variant is not supported","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"orc/src/main/java/org/apache/iceberg/orc/OrcSchemaWithTypeVisitor.java","lineNumber":114,"sourceCode":"\n    return visitor.variant(iVariant, variant, metadataResult, valueResult);\n  }\n\n  public T record(\n      Types.StructType iStruct, TypeDescription record, List<String> names, List<T> fields) {\n    return null;\n  }\n\n  public T list(Types.ListType iList, TypeDescription array, T element) {\n    return null;\n  }\n\n  public T map(Types.MapType iMap, TypeDescription map, T key, T value) {\n    return null;\n  }\n\n  public T variant(Types.VariantType iVariant, TypeDescription variant, T metadata, T value) {\n    throw new UnsupportedOperationException(\"Variant is not supported\");\n  }\n\n  public T primitive(Type.PrimitiveType iPrimitive, TypeDescription primitive) {\n    return null;\n  }\n}\n","sourceCodeStart":96,"sourceCodeEnd":121,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/orc/src/main/java/org/apache/iceberg/orc/OrcSchemaWithTypeVisitor.java#L96-L121","documentation":"OrcSchemaWithTypeVisitor's variant() callback handles ORC variant nodes paired with an Iceberg Types.VariantType; the base-class default throws UnsupportedOperationException. Any concrete visitor that does not override it will throw when the schema walk reaches a variant type.","triggerScenarios":"OrcSchemaWithTypeVisitor.visit dispatches to visitVariant → visitor.variant() on a schema containing an ORC variant, and the visitor subclass has not overridden variant().","commonSituations":"Schema conversion or read/write planning over Iceberg tables with VariantType stored as ORC; custom visitors built on older Iceberg versions that predate variant support.","solutions":["Upgrade iceberg-orc to a release with variant support so built-in visitors override variant().","Override variant() in your custom OrcSchemaWithTypeVisitor to return a handled value.","Use Parquet/Avro for tables containing variant columns.","Drop variant columns from ORC-backed tables before running schema operations."],"exampleFix":"// after: override in visitor subclass\n@Override\npublic T variant(Types.VariantType iVariant, TypeDescription variant, T metadata, T value) {\n  return value; // propagate handled child result\n}","handlingStrategy":"try-catch","validationCode":"// detect variant columns in the ORC schema before visiting\nboolean hasVariant = streamChildren(schema).anyMatch(t -> t.getCategory() == TypeDescription.Category.STRUCT && isVariantStruct(t));","typeGuard":null,"tryCatchPattern":"try { OrcSchemaWithTypeVisitor.visit(iType, schema, visitor); } catch (UnsupportedOperationException e) { if (e.getMessage().contains(\"Variant is not supported\")) { degradeGracefully(); } else throw e; }","preventionTips":["Override variant() in every custom OrcSchemaWithTypeVisitor subclass","Check table schema for VariantType before choosing ORC as the file format","Upgrade iceberg-orc when adopting variant columns"],"tags":["orc","variant","visitor","iceberg-types"],"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-14T16:17:12.679Z"}