presto-main/src/main/java/io/prestosql/sql/planner/optimizations/joins/JoinGraph.java/JoinGraph/replacementGraph
class JoinGraph:        private JoinGraph replacementGraph(PlanNode oldNode, PlanNode newNode, Context context)
        {
            // TODO optimize when idea is generally approved
            List<Symbol> symbols = context.symbolSources.entrySet().stream()
                    .filter(entry -> entry.getValue() == oldNode)
                    .map(Map.Entry::getKey)
                    .collect(toImmutableList());
            symbols.forEach(symbol -> context.symbolSources.put(symbol, newNode));

            return new JoinGraph(newNode);
        }