{"record":{"id":"bdcf9d5703df3d4b","repo":"apache/iceberg","slug":"unknown-primitive-physical-type-primitivetype","errorCode":null,"errorMessage":"Unknown primitive physical type: ${primitiveType}","messagePattern":"Unknown primitive physical type: (.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"parquet/src/main/java/org/apache/iceberg/parquet/VariantShreddingAnalyzer.java","lineNumber":421,"sourceCode":"          Types.optional(PrimitiveType.PrimitiveTypeName.INT64)\n              .as(LogicalTypeAnnotation.timestampType(false, LogicalTypeAnnotation.TimeUnit.MICROS))\n              .named(TYPED_VALUE);\n      case TIMESTAMPTZ_NANOS ->\n          Types.optional(PrimitiveType.PrimitiveTypeName.INT64)\n              .as(LogicalTypeAnnotation.timestampType(true, LogicalTypeAnnotation.TimeUnit.NANOS))\n              .named(TYPED_VALUE);\n      case TIMESTAMPNTZ_NANOS ->\n          Types.optional(PrimitiveType.PrimitiveTypeName.INT64)\n              .as(LogicalTypeAnnotation.timestampType(false, LogicalTypeAnnotation.TimeUnit.NANOS))\n              .named(TYPED_VALUE);\n      case DECIMAL4, DECIMAL8, DECIMAL16 -> createDecimalTypedValue(info);\n      case UUID ->\n          Types.optional(PrimitiveType.PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY)\n              .length(16)\n              .as(LogicalTypeAnnotation.uuidType())\n              .named(TYPED_VALUE);\n      default ->\n          throw new UnsupportedOperationException(\n              \"Unknown primitive physical type: \" + primitiveType);\n    };\n  }\n\n  /** Tracks occurrence count and types for a single field. */\n  private static class FieldInfo {\n    private static final PhysicalType[] PHYSICAL_TYPES = PhysicalType.values();\n\n    private static final List<PhysicalType> INTEGER_TYPES =\n        List.of(PhysicalType.INT8, PhysicalType.INT16, PhysicalType.INT32, PhysicalType.INT64);\n\n    private static final List<PhysicalType> DECIMAL_TYPES =\n        List.of(PhysicalType.DECIMAL4, PhysicalType.DECIMAL8, PhysicalType.DECIMAL16);\n\n    private final int[] typeCounts = new int[PHYSICAL_TYPES.length];\n    private int maxDecimalScale = 0;\n    private int maxDecimalIntegerDigits = 0;\n    private int observationCount = 0;","sourceCodeStart":403,"sourceCodeEnd":439,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/parquet/src/main/java/org/apache/iceberg/parquet/VariantShreddingAnalyzer.java#L403-L439","documentation":"Thrown by VariantShreddingAnalyzer.createPrimitiveTypedValue() when it encounters a Parquet primitive physical type it cannot translate into a typed_value schema node while analyzing a shredding schema. This indicates the analyzer was handed a physical type outside the set it supports for Variant typed values.","triggerScenarios":"createPrimitiveTypedValue() called with a primitiveType that matches no case in its switch (e.g. an unexpected primitive reached the analyzer's typed-value construction via buildTypedValue).","commonSituations":"Programmatic shredding-spec construction passing an unmapped PrimitiveTypeName; a new Parquet primitive added upstream but not yet handled; internal misuse of the analyzer API with raw primitives instead of Iceberg Types.","solutions":["Check which PrimitiveTypeName you pass into the analyzer and map it to a supported one for Variant typed values (e.g. BOOLEAN, INT32/64, FLOAT/DOUBLE, BINARY, FIXED_LEN_BYTE_ARRAY with UUID logical type).","If you need the type for a valid Variant value, convert it before analysis (e.g. wrap fixed bytes with uuidType()).","Upgrade Iceberg if the physical type is newly supported; otherwise open an issue to add a case for it."],"exampleFix":"// before\nanalyzer.buildTypedValue(PrimitiveTypeName.INT96)\n\n// after\nanalyzer.buildTypedValue(PrimitiveTypeName.INT64) // use a supported primitive for typed_value","handlingStrategy":"validation","validationCode":"switch (primitiveType) {\n  case BOOLEAN, INT32, INT64, FLOAT, DOUBLE, BINARY, FIXED_LEN_BYTE_ARRAY -> ok();\n  default -> throw new IllegalArgumentException(\"Unsupported for typed_value: \" + primitiveType);\n}","typeGuard":"boolean isAnalyzablePrimitive(PrimitiveTypeName p) {\n  return switch (p) {\n    case BOOLEAN, INT32, INT64, FLOAT, DOUBLE, BINARY, FIXED_LEN_BYTE_ARRAY -> true;\n    default -> false;\n  };\n}","tryCatchPattern":"try {\n  analyzer.buildTypedValue(primitiveType);\n} catch (UnsupportedOperationException e) {\n  log.warn(\"Falling back to unshredded variant: {}\", e.getMessage());\n  useUnshreddedSchema();\n}","preventionTips":["Feed the analyzer Iceberg Types-derived primitives rather than raw engine types","Handle INT96 and unknown primitives explicitly before analysis","Keep the Iceberg version current so new primitives get analyzer support"],"tags":["parquet","variant","shredding","analyzer"],"backgroundTag":"unsupported-operation","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"}