seawinde commented on code in PR #26120: URL: https://github.com/apache/doris/pull/26120#discussion_r1381197991
########## fe/fe-core/src/main/java/org/apache/doris/nereids/trees/TreeNode.java: ########## @@ -184,6 +184,27 @@ default boolean anyMatch(Predicate<TreeNode<NODE_TYPE>> predicate) { return false; } + /** + * iterate top down and test predicate, if matched then collect it. + * + * @param predicate predicate + * @param matchedNodes the nodes that satisfies the predicate + * @param traversalAll whether continue to recurse or not when predicate is true + */ + default void matchAndCollect(Predicate<TreeNode<NODE_TYPE>> predicate, + List<TreeNode<NODE_TYPE>> matchedNodes, + boolean traversalAll) { + if (predicate.test(this)) { Review Comment: It's the same, will use treeNode collect method instead -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org