zhiqiang-hhhh commented on code in PR #32746: URL: https://github.com/apache/doris/pull/32746#discussion_r1546155094
########## fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java: ########## @@ -136,6 +136,34 @@ public class FunctionCallExpr extends Expr { return returnType; } }; + + java.util.function.BiFunction<ArrayList<Expr>, Type, Type> truncateRule = (children, returnType) -> { + Preconditions.checkArgument(children != null && children.size() > 0); + if (children.size() == 1 && children.get(0).getType().isDecimalV3()) { + return ScalarType.createDecimalV3Type(children.get(0).getType().getPrecision(), 0); + } else if (children.size() == 2) { + Expr scaleExpr = children.get(1); + if (scaleExpr instanceof IntLiteral + || (scaleExpr instanceof CastExpr && scaleExpr.getChild(0) instanceof IntLiteral)) { Review Comment: For expr whose result is constexpr, we will go to branch in L146. -- 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