zhaohaidao commented on a change in pull request #8550:
URL: https://github.com/apache/kafka/pull/8550#discussion_r418816470



##########
File path: 
streams/src/main/java/org/apache/kafka/streams/processor/internals/InternalTopologyBuilder.java
##########
@@ -633,6 +634,43 @@ public final void copartitionSources(final 
Collection<String> sourceNodes) {
         copartitionSourceGroups.add(Collections.unmodifiableSet(new 
HashSet<>(sourceNodes)));
     }
 
+    public void validateCopartition() {
+        final List<Set<String>> copartitionGroups =
+                copartitionSourceGroups
+                        .stream()
+                        .map(sourceGroup -> sourceGroup
+                                .stream()
+                                .flatMap(node -> 
nodeToSourceTopics.get(node).stream())
+                                .collect(Collectors.toSet())
+                        ).collect(Collectors.toList());
+        for (final Set<String> copartition : copartitionGroups) {
+            final Map<String, Integer> topicPartNum = new HashMap<>();
+            copartition.forEach(topic -> {
+                final InternalTopicProperties prop = 
internalTopicNamesWithProperties.get(topic);
+                if (prop != null && prop.getNumberOfPartitions().isPresent()) {
+                    topicPartNum.put(topic, 
prop.getNumberOfPartitions().get());
+                }
+            });
+            internalTopicNamesWithProperties.forEach((topic, prop) -> {
+                if (copartition.contains(topic) && 
prop.getNumberOfPartitions().isPresent()) {
+                    topicPartNum.put(topic, 
prop.getNumberOfPartitions().get());

Review comment:
       Sorry, this is the side effects of unreasonable rebase operation.
   I have removed this redundant part




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to