private GraphNode getKeyChangingParentNode(final GraphNode repartitionNode) {
        final GraphNode shouldBeKeyChangingNode = findParentNodeMatching(repartitionNode, n -> n.isKeyChangingOperation() || n.isValueChangingOperation());

        final GraphNode keyChangingNode = findParentNodeMatching(repartitionNode, GraphNode::isKeyChangingOperation);
        if (shouldBeKeyChangingNode != null && shouldBeKeyChangingNode.equals(keyChangingNode)) {
            return keyChangingNode;
        }
        return null;
    }
The self-join rewriting can be applied if the StreamStreamJoinNode has a single parent.
If the join is a self-join, remove the node KStreamJoinWindow corresponding to the
right argument of the join (the "other"). The join node may have multiple siblings but for
this rewriting we only care about the ThisKStreamJoinWindow and the OtherKStreamJoinWindow.
We iterate over all the siblings to identify these two nodes so that we can remove the
latter.
streams/src/main/java/org/apache/kafka/streams/kstream/internals/InternalStreamsBuilder.java