apache/iceberg · info

Ignoring ' ' as such values are constant within a partition

Error message

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

What it means

WARN from SparkZOrderFileRewriteRunner.validZOrderColNames: a column requested for z-ordering is an identity partition column, so its values are constant within each partition and contribute nothing to z-order. The column is dropped from the z-order column list instead of failing the job.

Solutions

  1. Remove identity partition columns from the z-order column option; z-order only helps on non-partition columns.
  2. Keep the warning if the config is generic — behavior is correct, the column is just skipped.
  3. If you intended clustering within partitions, choose non-partition columns with high cardinality.

Example fix

// before
action.option("z-order-cols", "date,user_id").execute(); // date is identity partition col
// after
action.option("z-order-cols", "user_id").execute();
Defensive patterns

Strategy: validation

Validate before calling

Set<Integer> partitionCols = table.spec().identitySourceFieldIds(); List<String> zCols = option("z-order-cols") filtered to cols whose fieldId not in partitionCols;

Type guard

boolean isIdentityPartitionCol(Schema schema, PartitionSpec spec, String name) { Types.NestedField f = schema.findField(name); return f != null && spec.identitySourceFieldIds().contains(f.fieldId()); }

Prevention

When it happens

Trigger: rewrite_data_files with z_order strategy including a column that is an identity partition field (e.g. z-order on (date, id) where date is an identity partition column).

Common situations: Auto-generated configs z-ordering all columns including partition keys; users expecting z-order to help on partition columns; partition-evolution leaving old identity partition columns in the option list.

Related errors


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

Appendix: source

Thrown at spark/v4.0/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)