private PlanNode replaceAllRecursive(PlanNode node, PlanNode nodeToReplace) {
    node = lookup.resolve(node);

    if (where.test(node)) {
      return nodeToReplace;
    }
    if (recurseOnlyWhen.test(node)) {
      List<PlanNode> sources =
          node.getChildren().stream()
              .map(source -> replaceAllRecursive(source, nodeToReplace))
              .collect(toImmutableList());
      return replaceChildren(node, sources);
    }
    return node;
  }
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