diff --git a/paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/source/ContinuousFileSplitEnumerator.java b/paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/source/ContinuousFileSplitEnumerator.java index 72b3742b3fb3..09f1d0d8f3c6 100644 --- a/paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/source/ContinuousFileSplitEnumerator.java +++ b/paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/source/ContinuousFileSplitEnumerator.java @@ -245,9 +245,10 @@ protected synchronized void assignSplits() { // create assignment Map> assignment = new HashMap<>(); Iterator readersAwait = readersAwaitingSplit.iterator(); + Set subtaskIds = context.registeredReaders().keySet(); while (readersAwait.hasNext()) { Integer task = readersAwait.next(); - if (!context.registeredReaders().containsKey(task)) { + if (!subtaskIds.contains(task)) { readersAwait.remove(); continue; }