prestodb/presto · error · IllegalArgumentException

Invalid partition field declaration:

Error message

Invalid partition field declaration: 

What it means

PartitionFields.buildPartitionField matches each partition-field declaration against known transform patterns (identity, year, month, day, hour, bucket, truncate); if no pattern matches the field string, a PrestoException with this message and the raw declaration is raised, indicating a syntactically invalid partition spec entry in DDL or table properties.

Source

Thrown at presto-iceberg/src/main/java/com/facebook/presto/iceberg/PartitionFields.java:112

            buildPartitionSpec(builder, field);
        }
        return builder.build();
    }

    @VisibleForTesting
    static void buildPartitionField(PartitionSpec.Builder builder, String field)
    {
        @SuppressWarnings("PointlessBooleanExpression")
        boolean matched = false ||
                tryMatch(field, IDENTITY_PATTERN, match -> builder.identity(match.group())) ||
                tryMatch(field, YEAR_PATTERN, match -> builder.year(match.group(1))) ||
                tryMatch(field, MONTH_PATTERN, match -> builder.month(match.group(1))) ||
                tryMatch(field, DAY_PATTERN, match -> builder.day(match.group(1))) ||
                tryMatch(field, HOUR_PATTERN, match -> builder.hour(match.group(1))) ||
                tryMatch(field, BUCKET_PATTERN, match -> builder.bucket(match.group(1), parseInt(match.group(2)))) ||
                tryMatch(field, TRUNCATE_PATTERN, match -> builder.truncate(match.group(1), parseInt(match.group(2))));
        if (!matched) {
            throw new IllegalArgumentException("Invalid partition field declaration: " + field);
        }
    }

    private static void buildPartitionSpec(PartitionSpec.Builder builder, IcebergPartitionField partitionField)
    {
        String field = partitionField.getName();
        PartitionTransformType type = partitionField.getTransform();
        OptionalInt parameter = partitionField.getParameter();
        switch (type) {
            case IDENTITY:
                builder.identity(field);
                break;
            case YEAR:
                builder.year(field);
                break;
            case MONTH:
                builder.month(field);
                break;

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Correct the partition field syntax, e.g. identity(col), year(col), bucket(n, col), truncate(w, col)
  2. Check for typos or unsupported transform names in the partitioned_by/spec declaration
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at presto-iceberg/src/main/java/com/facebook/presto/iceberg/PartitionFields.java:112 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/25310196ea7fc365. Report an issue: GitHub.