englefly commented on code in PR #50425: URL: https://github.com/apache/doris/pull/50425#discussion_r2062512357
########## fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/FoldConstantRuleOnFE.java: ########## @@ -515,6 +519,22 @@ public Expression visitCast(Cast cast, ExpressionRewriteContext context) { } } + // Check if the given literal value is safe to cast to the targetType. + // We need to guarantee FE cast result is identical with BE cast result. + // Otherwise, it's not safe. + protected boolean safeToCast(Cast cast) { + if (cast == null || cast.child() == null || cast.getDataType() == null) { Review Comment: if cast.child() is null, npe occurs in line 498("child.isNullLiteral()") I think it would be better to throw an exception -- 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