apache/iceberg · warning

Ignoring ' ' as such values are constant within a partition

Error message

Ignoring '{}' as such values are constant within a partition

What it means

SparkZOrderFileRewriteRunner excludes z-order input columns that are identity-partition columns, since their values are constant within a partition and z-curve ordering adds no benefit. It logs this warning and drops the column from the valid set instead of failing.

Solutions

  1. Remove the identity partition column from the z-order column list
  2. Select non-partition columns with high cardinality for z-ordering
  3. Review table partitioning to understand why the column is constant per partition

Example fix

// before
.option("z_order_columns", "date,user_id")  // 'date' is identity partitioned
// after
.option("z_order_columns", "user_id")
Defensive patterns

Strategy: validation

Validate before calling

Set<Integer> identityPartitionIds = table.spec().identitySourceFieldIds();
List<String> validCols = requestedCols.stream()
    .filter(c -> !identityPartitionIds.contains(table.schema().findField(c).fieldId()))
    .collect(Collectors.toList());

Prevention

When it happens

Trigger: Passing a column in the z-order rewrite option that resolves in the schema but whose field id is in identityPartitionFieldIds.

Common situations: Users include the table's identity partition column in z-order column options, e.g. copying an option list from a table whose partitioning later changed.

Related errors


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

Appendix: source

Thrown at spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/actions/SparkZOrderFileRewriteRunner.java:199

            ? schema.findField(Z_COLUMN) == null
            : schema.caseInsensitiveFindField(Z_COLUMN) == null,
        "Cannot zorder because the table has a column named '%s', which conflicts with Iceberg's internal Z-order column name",
        Z_COLUMN);

    List<String> validZOrderColNames = Lists.newArrayList();

    for (String colName : inputZOrderColNames) {
      Types.NestedField field =
          caseSensitive ? schema.findField(colName) : schema.caseInsensitiveFindField(colName);
      Preconditions.checkArgument(
          field != null,
          "Cannot find column '%s' in table schema (case sensitive = %s): %s",
          colName,
          caseSensitive,
          schema.asStruct());

      if (identityPartitionFieldIds.contains(field.fieldId())) {
        LOG.warn("Ignoring '{}' as such values are constant within a partition", colName);
      } else {
        validZOrderColNames.add(colName);
      }
    }

    Preconditions.checkArgument(
        !validZOrderColNames.isEmpty(),
        "Cannot ZOrder, all columns provided were identity partition columns and cannot be used");

    return validZOrderColNames;
  }
}

View on GitHub (pinned to 86d9c8fc54)