apache/iceberg · error · UnsupportedOperationException

Unsupported shredding type: <type>

Error message

Unsupported shredding type: <type>

What it means

The variant shredding schema builder maps each Iceberg type to a Parquet primitive type (boolean, int, long, float, double, string, binary, date, timestamp, uuid as FIXED_LEN_BYTE_ARRAY(16), etc.). When the requested primitive type has no mapping, UnsupportedOperationException is thrown naming the type.

Source

Thrown at parquet/src/main/java/org/apache/iceberg/parquet/ParquetVariantUtil.java:499

          return shreddedPrimitive(
              PrimitiveType.PrimitiveTypeName.INT64,
              LogicalTypeAnnotation.timeType(false, LogicalTypeAnnotation.TimeUnit.MICROS));
        case TIMESTAMPTZ_NANOS:
          return shreddedPrimitive(
              PrimitiveType.PrimitiveTypeName.INT64,
              LogicalTypeAnnotation.timestampType(true, LogicalTypeAnnotation.TimeUnit.NANOS));
        case TIMESTAMPNTZ_NANOS:
          return shreddedPrimitive(
              PrimitiveType.PrimitiveTypeName.INT64,
              LogicalTypeAnnotation.timestampType(false, LogicalTypeAnnotation.TimeUnit.NANOS));
        case UUID:
          return shreddedPrimitive(
              PrimitiveType.PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY,
              LogicalTypeAnnotation.uuidType(),
              16);
      }

      throw new UnsupportedOperationException("Unsupported shredding type: " + primitive.type());
    }

    private static GroupType objectFields(List<GroupType> fields) {
      Types.GroupBuilder<GroupType> builder = Types.buildGroup(Type.Repetition.OPTIONAL);
      for (GroupType field : fields) {
        checkField(field);
        builder.addField(field);
      }

      return builder.named("typed_value");
    }

    private static void checkField(GroupType fieldType) {
      Preconditions.checkArgument(
          fieldType.isRepetition(Type.Repetition.REQUIRED),
          "Invalid field type repetition: %s should be REQUIRED",
          fieldType.getRepetition());
    }

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Restrict shredding subtypes to supported primitives (don't shred decimal/time yet)
  2. Add a mapping case for the new type with an appropriate Parquet primitive (e.g. decimal via FIXED_LEN_BYTE_ARRAY)
  3. Upgrade Iceberg if the type gained shredding support in a later version

Example fix

// before: shredding a decimal variant subtype
Types.DecimalType.of(10, 2)
// after: leave decimal values unshredded in the variant value column
Types.NestedField.optional(id, "value", Types.StringType.get()) // or skip shredding spec for decimal
Defensive patterns

Strategy: validation

Validate before calling

Set<Class<? extends Type.PrimitiveType>> supported = ImmutableSet.of(
    BooleanType.class, IntegerType.class, LongType.class, FloatType.class,
    DoubleType.class, StringType.class, BinaryType.class, DateType.class,
    TimestampType.class, UUIDType.class);
Preconditions.checkArgument(supported.contains(type.getClass()),
    "Type cannot be shredded as primitive: %s", type);

Type guard

boolean isShreddablePrimitive(Type.PrimitiveType t) {
  return !(t instanceof Types.DecimalType) && !(t instanceof Types.TimeType);
}

Try / catch

try {
  schema = variantShredding.primitive(type);
} catch (UnsupportedOperationException e) {
  if (e.getMessage().startsWith("Unsupported shredding type")) {
    // leave the values unshredded in the variant value column
  } else throw e;
}

Prevention

When it happens

Trigger: Building a shredding schema (variantType/primitive) for an Iceberg Type whose PrimitiveType is not in the supported set — e.g. decimal, time, or nested types reaching the primitive branch.

Common situations: Shredding a variant column whose declared subtype is decimal or another not-yet-supported type; custom type extensions; spec/implementation gaps in newer type kinds.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/344050f3fa24e069. Report an issue: GitHub.