presto-main/src/main/java/io/prestosql/sql/planner/iterative/rule/PruneSemiJoinFilteringSourceColumns.java/PruneSemiJoinFilteringSourceColumns/apply
class PruneSemiJoinFilteringSourceColumns:    @Override
    public Result apply(SemiJoinNode semiJoinNode, Captures captures, Context context)
    {
        Set<Symbol> requiredFilteringSourceInputs = Streams.concat(
                Stream.of(semiJoinNode.getFilteringSourceJoinSymbol()),
                semiJoinNode.getFilteringSourceHashSymbol().map(Stream::of).orElse(Stream.empty()))
                .collect(toImmutableSet());

        return restrictOutputs(context.getIdAllocator(), semiJoinNode.getFilteringSource(), requiredFilteringSourceInputs)
                .map(newFilteringSource ->
                        semiJoinNode.replaceChildren(ImmutableList.of(semiJoinNode.getSource(), newFilteringSource)))
                .map(Result::ofPlanNode)
                .orElse(Result.empty());
    }