apache/flink · error · UnsupportedOperationException

Method createProcTime isn't supported in PartitionTimeCommit

Error message

Method createProcTime isn't supported in PartitionTimeCommitTrigger.

What it means

Thrown by PartitionTimeCommitTrigger when a PartitionCommitPredicate calls createProcTime() on the PredicateContext. The partition-time trigger only provides partition() and currentWatermark() because it decides commits by comparing the partition's derived time against the event-time watermark; creation processing-time is irrelevant to that decision. Any predicate that depends on processing-time will hit this UnsupportedOperationException.

Source

Thrown at flink-connectors/flink-connector-files/src/main/java/org/apache/flink/connector/file/table/stream/PartitionTimeCommitTrigger.java:129

            PredicateContext predicateContext = createPredicateContext(partition, watermark);
            if (partitionCommitPredicate.isPartitionCommittable(predicateContext)) {
                needCommit.add(partition);
                iter.remove();
            }
        }
        return needCommit;
    }

    private PredicateContext createPredicateContext(String partition, long watermark) {
        return new PredicateContext() {
            @Override
            public String partition() {
                return partition;
            }

            @Override
            public long createProcTime() {
                throw new UnsupportedOperationException(
                        "Method createProcTime isn't supported in PartitionTimeCommitTrigger.");
            }

            @Override
            public long currentProcTime() {
                throw new UnsupportedOperationException(
                        "Method currentProcTime isn't supported in PartitionTimeCommitTrigger.");
            }

            @Override
            public long currentWatermark() {
                return watermark;
            }
        };
    }

    @Override
    public void snapshotState(long checkpointId, long watermark) throws Exception {

View on GitHub (pinned to 2f3c205e92)

Solutions

  1. Switch sink.partition-commit-trigger to 'process-time' if the predicate genuinely needs creation processing-time.
  2. Rewrite the custom predicate to rely only on partition() and currentWatermark() when used with the partition-time trigger.
  3. Use PartitionCommitPredicate.createPredicateContext(partition, createProcTime, currentProcTime, watermark) in tests to supply all four values, avoiding the partial context.

Example fix

// before — custom predicate used with partition-time trigger
public boolean isPartitionCommittable(PredicateContext ctx) {
    long age = procTimeService.getCurrentProcessingTime() - ctx.createProcTime();
    return age > commitDelay;
}
// after — switch trigger to process-time, or rewrite predicate to use watermark
public boolean isPartitionCommittable(PredicateContext ctx) {
    LocalDateTime partTime = extractor.extract(partitionKeys, extractPartitionValues(new Path(ctx.partition())));
    return ctx.currentWatermark() > partTime.atZone(zone).toInstant().toEpochMilli() + commitDelay;
}
Defensive patterns

Strategy: validation

Validate before calling

// Before using a custom predicate, verify it matches the trigger type
String triggerType = conf.get(FileSystemConnectorOptions.SINK_PARTITION_COMMIT_TRIGGER).toString();
if ("PARTITION_TIME".equals(triggerType) && predicateUsesProcTime(myPredicate)) {
    throw new IllegalArgumentException(
        "Custom predicate requires processing-time; set sink.partition-commit-trigger=process-time");
}

Prevention

When it happens

Trigger: Configuring sink.partition-commit-trigger = 'partition-time' while supplying a custom PartitionCommitPredicate (via sink.partition-commit-policy-class) whose isPartitionCommittable() calls predicateContext.createProcTime().

Common situations: Reusing a process-time-oriented custom predicate against a partition-time trigger without adjusting it; or switching the trigger type from process-time to partition-time while keeping the same predicate.

Related errors


AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14). Data as JSON: /api/errors/a1b0f59d161a9d36. Report an issue: GitHub.