apache/iceberg · error · UnsupportedOperationException

Position delete writer does not support row data

Error message

Position delete writer does not support row data

What it means

Guard inside Avro's PositionDeleteWriter builder path: position-delete files index deletions by (file, position) and cannot carry row data, so building/configuring a position writer with row-oriented settings is rejected. Related preconditions in the same builder reject equality-field IDs and missing partition specs; this message specifically flags row data on a position delete writer.

Solutions

  1. Use an equality-delete writer when row data/fields are required
  2. Configure the delete writer without row-data settings for position deletes
  3. Do not set equality field IDs when building a position delete writer
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at core/src/main/java/org/apache/iceberg/avro/Avro.java:542 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at core/src/main/java/org/apache/iceberg/avro/Avro.java:542

          FileFormat.AVRO,
          location,
          spec,
          partition,
          keyMetadata,
          sortOrder,
          equalityFieldIds);
    }

    public <T> PositionDeleteWriter<T> buildPositionWriter() throws IOException {
      Preconditions.checkState(
          equalityFieldIds == null, "Cannot create position delete file using delete field ids");
      Preconditions.checkArgument(
          spec != null, "Spec must not be null when creating position delete writer");
      Preconditions.checkArgument(
          spec.isUnpartitioned() || partition != null,
          "Partition must not be null for partitioned writes");
      if (rowSchema != null) {
        throw new UnsupportedOperationException("Position delete writer does not support row data");
      }

      meta("delete-type", "position");

      appenderBuilder.schema(DeleteSchemaUtil.pathPosSchema());

      // the createWriterFunc is ignored, since only the path and position are written
      appenderBuilder.createWriterFunc(ignored -> new PositionDatumWriter());

      appenderBuilder.createContextFunc(WriteBuilder.Context::deleteContext);

      return new PositionDeleteWriter<>(
          appenderBuilder.build(), FileFormat.AVRO, location, spec, partition, keyMetadata);
    }
  }

  /** A {@link DatumWriter} implementation that wraps another to produce position deletes. */
  static class PositionDatumWriter implements MetricsAwareDatumWriter<PositionDelete<?>> {

View on GitHub (pinned to 86d9c8fc54)