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.getChildren()) {
        findAllRecursive(source, nodes);
      }
    }
  }
Return a list of matching nodes ordered as in pre-order traversal of the plan tree.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/PlanNodeSearcher.java