presto-main/src/main/java/io/prestosql/sql/planner/optimizations/PlanNodeSearcher.java/PlanNodeSearcher/findAllRecursive
class PlanNodeSearcher:    private <T extends PlanNode> void findAllRecursive(PlanNode node, ImmutableList.Builder<T> nodes)
    {
        node = lookup.resolve(node);

        if (where.test(node)) {
            nodes.add((T) node);
        }
        if (recurseOnlyWhen.test(node)) {
            for (PlanNode source : node.getSources()) {
                findAllRecursive(source, nodes);
            }
        }
    }