morrySnow commented on code in PR #50142: URL: https://github.com/apache/doris/pull/50142#discussion_r2049173372
########## fe/fe-core/src/main/java/org/apache/doris/nereids/util/TypeCoercionUtils.java: ########## @@ -153,6 +155,25 @@ public class TypeCoercionUtils { private static final Logger LOG = LogManager.getLogger(TypeCoercionUtils.class); + /** + * ensure the result's data type equals to the originExpr's dataType + */ + public static Expression ensureSameResultType( + Expression originExpr, Expression result, ExpressionRewriteContext context) { + DataType originDataType = originExpr.getDataType(); + DataType newDataType = result.getDataType(); + if (originDataType.equals(newDataType)) { + return result; + } + // backend can direct use all string like type without cast + if (originDataType.isStringLikeType() && newDataType.isStringLikeType()) { + return result; + } + return FoldConstantRuleOnFE.PATTERN_MATCH_INSTANCE.visitCast( Review Comment: functio name should related to constant folding -- 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