vpapavas commented on code in PR #12555: URL: https://github.com/apache/kafka/pull/12555#discussion_r961012010
########## streams/src/main/java/org/apache/kafka/streams/kstream/internals/InternalStreamsBuilder.java: ########## @@ -270,16 +272,20 @@ private void maybeAddNodeForOptimizationMetadata(final GraphNode node) { // use this method for testing only public void buildAndOptimizeTopology() { - buildAndOptimizeTopology(false); + buildAndOptimizeTopology(false, false); } - public void buildAndOptimizeTopology(final boolean optimizeTopology) { + public void buildAndOptimizeTopology( + final boolean optimizeTopology, final boolean optimizeSelfJoin) { mergeDuplicateSourceNodes(); if (optimizeTopology) { LOG.debug("Optimizing the Kafka Streams graph for repartition nodes"); optimizeKTableSourceTopics(); maybeOptimizeRepartitionOperations(); + if (optimizeSelfJoin) { Review Comment: The logical plan will have only one source since they will get merged as they are referring to the same topic. Hence, all the nodes will be children of the source node and siblings of the join node. For example, Case 2: ``` root -> source source -> join-window1, join-window2, stream-join ``` and Case 3: ``` root -> source source -> join-window1, map-values1, join-window2, stream-join ``` -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org