{"record":{"id":"d4a5c95dd605d5b1","repo":"apache/iceberg","slug":"unsupported-shredded-value-type-primitive-d4a5c9","errorCode":null,"errorMessage":"Unsupported shredded value type: ${primitive}","messagePattern":"Unsupported shredded value type: (.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"parquet/src/main/java/org/apache/iceberg/parquet/VariantWriterBuilder.java","lineNumber":131,"sourceCode":"              PhysicalType.BOOLEAN_FALSE);\n        case INT32:\n          return ParquetVariantWriters.primitive(\n              ParquetValueWriters.ints(desc), PhysicalType.INT32);\n        case INT64:\n          return ParquetVariantWriters.primitive(\n              ParquetValueWriters.longs(desc), PhysicalType.INT64);\n        case FLOAT:\n          // use an unboxed writer to skip metrics collection that requires an ID\n          return ParquetVariantWriters.primitive(\n              ParquetValueWriters.unboxed(desc), PhysicalType.FLOAT);\n        case DOUBLE:\n          // use an unboxed writer to skip metrics collection that requires an ID\n          return ParquetVariantWriters.primitive(\n              ParquetValueWriters.unboxed(desc), PhysicalType.DOUBLE);\n      }\n    }\n\n    throw new UnsupportedOperationException(\"Unsupported shredded value type: \" + primitive);\n  }\n\n  @Override\n  public ParquetValueWriter<?> value(\n      GroupType value, ParquetValueWriter<?> valueWriter, ParquetValueWriter<?> typedWriter) {\n    int valueDL = schema.getMaxDefinitionLevel(path(VALUE));\n    if (typedWriter != null) {\n      int typedValueDL = schema.getMaxDefinitionLevel(path(TYPED_VALUE));\n      return ParquetVariantWriters.shredded(valueDL, valueWriter, typedValueDL, typedWriter);\n    } else if (value.getType(VALUE).isRepetition(Type.Repetition.OPTIONAL)) {\n      return ParquetValueWriters.option(value.getType(VALUE), valueDL, valueWriter);\n    } else {\n      return valueWriter;\n    }\n  }\n\n  @Override\n  public ParquetValueWriter<?> object(","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/parquet/src/main/java/org/apache/iceberg/parquet/VariantWriterBuilder.java#L113-L149","documentation":"The write-side counterpart of the reader check: VariantWriterBuilder.primitive() throws when a shredded Variant typed_value column has a Parquet primitive that has no Variant writer mapping (e.g. FIXED_LEN_BYTE_ARRAY other than UUID, or INT96). The builder cannot produce a ParquetValueWriter for such primitives.","triggerScenarios":"Writing a shredded Variant column whose typed_value primitive is INT96 or a non-UUID FIXED_LEN_BYTE_ARRAY via VariantWriterBuilder.primitive().","commonSituations":"Custom writer pipelines shredding Variant values into non-conformant Parquet types; porting legacy INT96 timestamp columns into shredded Variant fields; copying a schema from a non-Variant table without adjusting types.","solutions":["Change the shredded typed_value type to a spec-allowed primitive (INT64 with timestamp/time logicals instead of INT96; BINARY or uuidType FLBA for bytes).","Disable shredding and write the Variant unshredded so arbitrary types stay inside the variant binary.","Update the pipeline that derives the shredding schema so it filters out unmappable primitives."],"exampleFix":"// before\nTypes.required(PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY).length(8).named(\"typed_value\")\n\n// after\nTypes.required(PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY).length(16).as(LogicalTypeAnnotation.uuidType()).named(\"typed_value\")","handlingStrategy":"validation","validationCode":"PrimitiveTypeName p = typedValue.getType().asPrimitiveType().getPrimitiveTypeName();\nboolean valid = p == BOOLEAN || p == BINARY || p == INT32 || p == INT64 || p == FLOAT || p == DOUBLE\n    || (p == FIXED_LEN_BYTE_ARRAY && uuidLogical(typedValue));\nPreconditions.checkArgument(valid, \"Cannot shred primitive %s into Variant\", p);","typeGuard":"boolean isWritableShreddedPrimitive(Type t) {\n  if (!t.isPrimitive()) return false;\n  PrimitiveTypeName p = t.asPrimitiveType().getPrimitiveTypeName();\n  return p != PrimitiveTypeName.INT96\n      && (p != PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY || isUuid(t.asPrimitiveType()));\n}","tryCatchPattern":"try {\n  buildVariantWriter(schema);\n} catch (UnsupportedOperationException e) {\n  writeUnshreddedVariant(value);\n}","preventionTips":["Derive shredding schemas from the Variant spec allow-list, not source table types","Replace INT96 with INT64 + timestamp logical before shredding","Test writers against a schema validator before production writes"],"tags":["parquet","variant","shredding","unsupported-type"],"backgroundTag":"unsupported-operation","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"}