EmmyMiao87 commented on a change in pull request #7045: URL: https://github.com/apache/incubator-doris/pull/7045#discussion_r749063395
########## File path: fe/fe-core/src/main/java/org/apache/doris/catalog/Type.java ########## @@ -1022,30 +1027,42 @@ public static Type getCmpType(Type t1, Type t2) { } // int family type and char family type should cast to char family type - if ((t1ResultType.isFixedPointType() && t2ResultType.isCharFamily()) || - (t2ResultType.isFixedPointType() && t1ResultType.isCharFamily())) { - return t1.isStringType() ? t1 : t2; + if ((t1ResultType.isFixedPointType() && t2ResultType.isCharFamily()) + || (t2ResultType.isFixedPointType() && t1ResultType.isCharFamily())) { + return t1.isStringType() ? t1 : t2; } if (t1ResultType == PrimitiveType.BIGINT && t2ResultType == PrimitiveType.BIGINT) { return getAssignmentCompatibleType(t1, t2, false); } - if ((t1ResultType == PrimitiveType.BIGINT - || t1ResultType == PrimitiveType.DECIMALV2) - && (t2ResultType == PrimitiveType.BIGINT - || t2ResultType == PrimitiveType.DECIMALV2)) { + if ((t1ResultType == PrimitiveType.BIGINT || t1ResultType == PrimitiveType.DECIMALV2) + && (t2ResultType == PrimitiveType.BIGINT || t2ResultType == PrimitiveType.DECIMALV2)) { return Type.DECIMALV2; } - if ((t1ResultType == PrimitiveType.BIGINT - || t1ResultType == PrimitiveType.LARGEINT) - && (t2ResultType == PrimitiveType.BIGINT - || t2ResultType == PrimitiveType.LARGEINT)) { + if ((t1ResultType == PrimitiveType.BIGINT || t1ResultType == PrimitiveType.LARGEINT) + && (t2ResultType == PrimitiveType.BIGINT || t2ResultType == PrimitiveType.LARGEINT)) { return Type.LARGEINT; } return Type.DOUBLE; } public static boolean canCompareDate(PrimitiveType t1, PrimitiveType t2) { + if (t1 == PrimitiveType.DATE) { + if (t2 == PrimitiveType.DATE || t2.isStringType() || t2.isIntegerType()) { Review comment: I create a issue to deal with redundant castExpr. It will be fixed later. -- 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