morrySnow commented on code in PR #41546: URL: https://github.com/apache/doris/pull/41546#discussion_r1796374347
########## fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/FoldConstantRuleOnBE.java: ########## @@ -264,7 +261,7 @@ private static boolean shouldSkipFold(Expression expr) { // This kind of function is often used to change the attributes of columns. // Folding will make it impossible to construct columns such as nullable(1). - if (expr instanceof Nullable || expr instanceof NonNullable) { + if (expr.containsType(Nullable.class) || expr.containsType(NonNullable.class)) { Review Comment: this will traverse expr tree too many times, could we only traverse once by `expr.anyMatch(e -> shouldSkipFold(e))` ? -- 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