apache/flink · error · UnsupportedOperationException

Method currentWatermark isn't supported in ProcTimeCommitTri

Error message

Method currentWatermark isn't supported in ProcTimeCommitTrigger.

What it means

Thrown by ProcTimeCommitTrigger when a PartitionCommitPredicate calls currentWatermark() on the PredicateContext. The process-time trigger only provides partition(), createProcTime(), and currentProcTime(); it does not track watermarks because commit decisions are based on elapsed processing-time, not event-time. Calling currentWatermark() on this context is a semantic mismatch.

Source

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

        return new PredicateContext() {
            @Override
            public String partition() {
                return partition;
            }

            @Override
            public long createProcTime() {
                return createProcTime;
            }

            @Override
            public long currentProcTime() {
                return procTimeService.getCurrentProcessingTime();
            }

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

    @Override
    public void snapshotState(long checkpointId, long watermark) throws Exception {
        pendingPartitionsState.update(Collections.singletonList(new HashMap<>(pendingPartitions)));
    }

    @Override
    public List<String> endInput() {
        ArrayList<String> partitions = new ArrayList<>(pendingPartitions.keySet());
        pendingPartitions.clear();
        return partitions;
    }
}

View on GitHub (pinned to 2f3c205e92)

Solutions

  1. Switch sink.partition-commit-trigger to 'partition-time' so the watermark context is populated.
  2. Rewrite the custom predicate to use createProcTime() and currentProcTime() instead of currentWatermark().
  3. Use the built-in ProcTimeCommitPredicate which only relies on processing-time methods.

Example fix

// before — watermark predicate used with process-time trigger
public boolean isPartitionCommittable(PredicateContext ctx) {
    return ctx.currentWatermark() > partitionTime + commitDelay;
}
// after — use processing-time for process-time trigger
public boolean isPartitionCommittable(PredicateContext ctx) {
    return ctx.currentProcTime() - ctx.createProcTime() >= commitDelayMs;
}
Defensive patterns

Strategy: validation

Validate before calling

// Verify predicate does not call currentWatermark when using process-time trigger
String triggerType = conf.get(FileSystemConnectorOptions.SINK_PARTITION_COMMIT_TRIGGER).toString();
if ("PROCESS_TIME".equals(triggerType) && predicateUsesWatermark(myPredicate)) {
    throw new IllegalArgumentException(
        "Custom predicate requires watermark; set sink.partition-commit-trigger=partition-time");
}

Prevention

When it happens

Trigger: Configuring sink.partition-commit-trigger = 'process-time' with a custom PartitionCommitPredicate that invokes predicateContext.currentWatermark().

Common situations: Using a partition-time-oriented predicate (e.g. the built-in PartitionTimeCommitPredicate) with a process-time trigger; or a custom predicate that was written for watermark semantics but deployed with process-time trigger.

Related errors


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