use of org.apache.flink.api.connector.source.SplitsAssignment in project flink by apache.
the class CoordinatorTestUtils method getSplitsAssignment.
/**
* Create a SplitsAssignment. The assignments looks like following: Subtask 0: Splits {0}
* Subtask 1: Splits {1, 2} Subtask 2: Splits {3, 4, 5}
*/
static SplitsAssignment<MockSourceSplit> getSplitsAssignment(int numSubtasks, int startingSplitId) {
Map<Integer, List<MockSourceSplit>> assignments = new HashMap<>();
int splitId = startingSplitId;
for (int subtaskIndex = 0; subtaskIndex < numSubtasks; subtaskIndex++) {
List<MockSourceSplit> subtaskAssignment = new ArrayList<>();
for (int j = 0; j < subtaskIndex + 1; j++) {
subtaskAssignment.add(new MockSourceSplit(splitId++));
}
assignments.put(subtaskIndex, subtaskAssignment);
}
return new SplitsAssignment<>(assignments);
}
Aggregations