EmmyMiao87 commented on a change in pull request #7045:
URL: https://github.com/apache/incubator-doris/pull/7045#discussion_r744635142



##########
File path: 
fe/fe-core/src/main/java/org/apache/doris/analysis/BinaryPredicate.java
##########
@@ -294,29 +291,39 @@ private Type getCmpType() throws AnalysisException {
             }
         }
 
-        if (canCompareDate(getChild(0).getType().getPrimitiveType(), 
getChild(1).getType().getPrimitiveType())) {
+        Type t1 = getChild(0).getType();
+        Type t2 = getChild(1).getType();
+
+        if(t1.getPrimitiveType() == PrimitiveType.DATE && 
t2.getPrimitiveType() == PrimitiveType.DATE) {
+            return Type.DATE;

Review comment:
       Maybe following is better ?
   ```
   if (canCompareDtat()) {
       return t1.type();
   }
   ```

##########
File path: fe/fe-core/src/main/java/org/apache/doris/catalog/Type.java
##########
@@ -1005,12 +1005,17 @@ public static Type getCmpType(Type t1, Type t2) {
             return t1;
         }
 
-        PrimitiveType t1ResultType = t1.getResultType().getPrimitiveType();
-        PrimitiveType t2ResultType = t2.getResultType().getPrimitiveType();
+        if (t1.getPrimitiveType() == PrimitiveType.DATE && 
t2.getPrimitiveType() == PrimitiveType.DATE) {

Review comment:
       same as above

##########
File path: 
fe/fe-core/src/main/java/org/apache/doris/analysis/BinaryPredicate.java
##########
@@ -294,29 +291,39 @@ private Type getCmpType() throws AnalysisException {
             }
         }
 
-        if (canCompareDate(getChild(0).getType().getPrimitiveType(), 
getChild(1).getType().getPrimitiveType())) {
+        Type t1 = getChild(0).getType();
+        Type t2 = getChild(1).getType();
+
+        if(t1.getPrimitiveType() == PrimitiveType.DATE && 
t2.getPrimitiveType() == PrimitiveType.DATE) {

Review comment:
       notice code format

##########
File path: 
fe/fe-core/src/main/java/org/apache/doris/analysis/BinaryPredicate.java
##########
@@ -294,29 +291,39 @@ private Type getCmpType() throws AnalysisException {
             }
         }
 
-        if (canCompareDate(getChild(0).getType().getPrimitiveType(), 
getChild(1).getType().getPrimitiveType())) {
+        Type t1 = getChild(0).getType();
+        Type t2 = getChild(1).getType();
+
+        if(t1.getPrimitiveType() == PrimitiveType.DATE && 
t2.getPrimitiveType() == PrimitiveType.DATE) {
+            return Type.DATE;
+        }
+
+        if (canCompareDate(t1.getPrimitiveType(), t2.getPrimitiveType())) {
             return Type.DATETIME;
         }
 
+        PrimitiveType t1ResultType = t1.getResultType().getPrimitiveType();

Review comment:
       So, why we need to check the result type rather than origin type?




-- 
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

Reply via email to