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

SparkHilbertFileRewriteRunner filters z-order/hilbert input columns that are identity-partition columns, because such columns are constant within each partition and hilbert curve ordering on them is meaningless. It logs this warning and excludes the column instead of failing.

Solutions

  1. Remove the partition column from the hilbert column option list
  2. Choose high-cardinality non-partition columns for hilbert ordering
  3. If full-table coverage of that column is needed, rewrite without relying on hilbert ordering for it

Example fix

// before
.option("hilbert_columns", "date,id")   // 'date' is an identity partition column
// after
.option("hilbert_columns", "id")        // exclude constant-per-partition columns
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 name via the hilbert rewrite options that is also an identity transform partition field; the column resolves in the schema but its field id is in identityPartitionFieldIds.

Common situations: Users reuse the table's partition column in the hilbert ordering option list, often copy-pasted from a previous unpartitioned table configuration.

Related errors


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

Appendix: source

Thrown at spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/actions/SparkHilbertFileRewriteRunner.java:154

            ? schema.findField(H_COLUMN) == null
            : schema.caseInsensitiveFindField(H_COLUMN) == null,
        "Cannot HILBERT because the table has a column named '%s', which conflicts with Iceberg's internal Hilbert column name",
        H_COLUMN);

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

    for (String colName : inputHilbertColNames) {
      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 {
        validHilbertColNames.add(colName);
      }
    }

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

    return validHilbertColNames;
  }
}

View on GitHub (pinned to 86d9c8fc54)