{"record":{"id":"515c029c6872a2e9","repo":"apache/iceberg","slug":"variant-is-not-supported","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/OrcSchemaVisitor.java","lineNumber":195,"sourceCode":"\n  public void afterValueField(TypeDescription value) {\n    afterField(valueName(), value);\n  }\n\n  public T record(TypeDescription record, List<String> names, List<T> fields) {\n    return null;\n  }\n\n  public T list(TypeDescription array, T element) {\n    return null;\n  }\n\n  public T map(TypeDescription map, T key, T value) {\n    return null;\n  }\n\n  public T variant(TypeDescription variant, T metadata, T value) {\n    throw new UnsupportedOperationException(\"Variant is not supported\");\n  }\n\n  public T primitive(TypeDescription primitive) {\n    return null;\n  }\n\n  protected String[] currentPath() {\n    return Lists.newArrayList(fieldNames.descendingIterator()).toArray(new String[0]);\n  }\n\n  protected String[] path(String name) {\n    List<String> list = Lists.newArrayList(fieldNames.descendingIterator());\n    list.add(name);\n    return list.toArray(new String[0]);\n  }\n}\n","sourceCodeStart":177,"sourceCodeEnd":212,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/orc/src/main/java/org/apache/iceberg/orc/OrcSchemaVisitor.java#L177-L212","documentation":"OrcSchemaVisitor's variant() callback is a default hook for ORC variant types; the base-class default unconditionally throws UnsupportedOperationException. Visitors that do not override variant() will throw when the visited ORC schema contains a variant type.","triggerScenarios":"OrcSchemaVisitor.visitVariant dispatches to visitor.variant() on a schema containing an ORC variant type, and the concrete visitor (e.g. StatsColumnsVisitor, ID mapper) has not overridden variant().","commonSituations":"Reading or writing Iceberg tables with variant columns through the ORC file format; running metadata operations (metrics collection, schema mapping) over a schema containing VariantType.","solutions":["Upgrade to an Iceberg version whose ORC visitor supports variant columns, if available.","Store the table with Parquet or Avro instead of ORC if variant columns are required.","If you implement a custom OrcSchemaVisitor, override variant() to return a value instead of relying on the throwing default.","Drop or migrate variant columns in ORC-backed tables."],"exampleFix":"// before: custom visitor relies on default\n// after\n@Override\npublic T variant(TypeDescription variant, T metadata, T value) {\n  return null; // or handle metadata/value children\n}","handlingStrategy":"try-catch","validationCode":"if (schema.findSubtype(\"variant\", true) != null) { /* schema contains variant; ensure visitor supports it or skip */ }","typeGuard":null,"tryCatchPattern":"try { result = OrcSchemaVisitor.visit(schema, visitor); } catch (UnsupportedOperationException e) { if (e.getMessage().contains(\"Variant is not supported\")) { fallbackWithoutVariant(schema); } else throw e; }","preventionTips":["Check for variant columns in the schema before running ORC metadata operations","Use Parquet/Avro file formats for tables with VariantType","When writing custom OrcSchemaVisitor subclasses, always override variant()"],"tags":["orc","variant","visitor","unsupported-type"],"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"}