rkhachatryan commented on code in PR #21362:
URL: https://github.com/apache/flink/pull/21362#discussion_r1033165454
##########
flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/co/CoBroadcastWithKeyedOperatorTest.java:
##########
@@ -556,9 +559,27 @@ public void testScaleUp() throws Exception {
3,
2,
operatorSubtaskState3)) {
- testHarness1.processElement1(new StreamRecord<>("trigger"));
- testHarness2.processElement1(new StreamRecord<>("trigger"));
- testHarness3.processElement1(new StreamRecord<>("trigger"));
+
+ // Since there is a keyed operator, we should follow the key
partition rules.
+ Map<TwoInputStreamOperatorTestHarness<String, Integer, String>,
KeyGroupRange>
+ keyGroupPartition = new HashMap<>();
+ keyGroupPartition.put(testHarness1, KeyGroupRange.of(0, 3));
+ keyGroupPartition.put(testHarness2, KeyGroupRange.of(4, 6));
+ keyGroupPartition.put(testHarness3, KeyGroupRange.of(7, 9));
+ while (!keyGroupPartition.isEmpty()) {
+ String triggerKey =
String.valueOf(ThreadLocalRandom.current().nextLong());
+ for (Map.Entry<
+ TwoInputStreamOperatorTestHarness<String,
Integer, String>,
+ KeyGroupRange>
+ entry : keyGroupPartition.entrySet()) {
+ if (entry.getValue()
+
.contains(KeyGroupRangeAssignment.assignToKeyGroup(triggerKey, 10))) {
+ entry.getKey().processElement1(new
StreamRecord<>(triggerKey));
+ keyGroupPartition.remove(entry.getKey());
+ break;
+ }
+ }
+ }
Review Comment:
Thanks!
--
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]