loserwang1024 commented on code in PR #27149:
URL: https://github.com/apache/flink/pull/27149#discussion_r2476218524


##########
flink-core/src/test/java/org/apache/flink/api/connector/source/mocks/MockSplitEnumerator.java:
##########
@@ -50,22 +52,24 @@ public class MockSplitEnumerator
 
     public MockSplitEnumerator(int numSplits, 
SplitEnumeratorContext<MockSourceSplit> enumContext) {
         this(new HashSet<>(), enumContext);
+        List<MockSourceSplit> unassignedSplits = new ArrayList<>();
         for (int i = 0; i < numSplits; i++) {
             unassignedSplits.add(new MockSourceSplit(i));
         }
+        calculateAndPutPendingAssignments(unassignedSplits);
     }
 
     public MockSplitEnumerator(
             Set<MockSourceSplit> unassignedSplits,
             SplitEnumeratorContext<MockSourceSplit> enumContext) {
-        this.unassignedSplits =
-                new TreeSet<>(Comparator.comparingInt(o -> 
Integer.parseInt(o.splitId())));
-        this.unassignedSplits.addAll(unassignedSplits);
+        this.pendingSplitAssignment = new HashMap<>();
+        this.globalSplitAssignment = new HashMap<>();
         this.enumContext = enumContext;
         this.handledSourceEvent = new ArrayList<>();
         this.successfulCheckpoints = new ArrayList<>();
         this.started = false;
         this.closed = false;
+        calculateAndPutPendingAssignments(unassignedSplits);

Review Comment:
   Maybe recalculateAssignments? Don't assign them until the split is added.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to