public <T extends PlanNode> PlanMatchPattern with(Class<T> clazz, Predicate<T> predicate) {
    return with(
        new Matcher() {
          @Override
          public boolean shapeMatches(PlanNode node) {
            return clazz.isInstance(node);
          }

          @Override
          public MatchResult detailMatches(
              PlanNode node,
              SessionInfo sessionInfo,
              Metadata metadata,
              SymbolAliases symbolAliases) {
            if (predicate.test(clazz.cast(node))) {
              return match();
            }

            return NO_MATCH;
          }
        });
  }
Matches to any tree of nodes with children matching to given source matchers.
anyTree(tableScan("nation")) - will match to any plan which all leafs contain any node
containing table scan from nation table.

<p>Note: anyTree does not match zero nodes. E.g. output(anyTree(tableScan)) will NOT match
TableScan node followed by OutputNode.
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/planner/assertions/PlanMatchPattern.java