presto-main/src/main/java/io/prestosql/sql/planner/iterative/rule/PruneSemiJoinColumns.java/PruneSemiJoinColumns/pushDownProjectOff
class PruneSemiJoinColumns:    @Override
    protected Optional<PlanNode> pushDownProjectOff(PlanNodeIdAllocator idAllocator, SemiJoinNode semiJoinNode, Set<Symbol> referencedOutputs)
    {
        if (!referencedOutputs.contains(semiJoinNode.getSemiJoinOutput())) {
            return Optional.of(semiJoinNode.getSource());
        }

        Set<Symbol> requiredSourceInputs = Streams.concat(
                referencedOutputs.stream()
                        .filter(symbol -> !symbol.equals(semiJoinNode.getSemiJoinOutput())),
                Stream.of(semiJoinNode.getSourceJoinSymbol()),
                semiJoinNode.getSourceHashSymbol().map(Stream::of).orElse(Stream.empty()))
                .collect(toImmutableSet());

        return restrictOutputs(idAllocator, semiJoinNode.getSource(), requiredSourceInputs)
                .map(newSource ->
                        semiJoinNode.replaceChildren(ImmutableList.of(
                                newSource, semiJoinNode.getFilteringSource())));
    }