WingsGo commented on a change in pull request #3527:
URL: https://github.com/apache/incubator-doris/pull/3527#discussion_r430827305



##########
File path: fe/src/main/java/org/apache/doris/analysis/BinaryPredicate.java
##########
@@ -263,15 +263,9 @@ public void vectorizedAnalyze(Analyzer analyzer) {
 
     private boolean canCompareDate(PrimitiveType t1, PrimitiveType t2) {
         if (t1.isDateType()) {
-            if (t2.isDateType() || t2.isStringType()) {
-                return true;
-            }
-            return false;
+            return t2.isDateType() || t2.isStringType();
         } else if (t2.isDateType()) {
-            if (t1.isStringType()) {
-                return true;
-            }
-            return false;
+            return t1.isStringType();

Review comment:
       I will fix it.

##########
File path: fe/src/main/java/org/apache/doris/analysis/BinaryPredicate.java
##########
@@ -263,15 +263,9 @@ public void vectorizedAnalyze(Analyzer analyzer) {
 
     private boolean canCompareDate(PrimitiveType t1, PrimitiveType t2) {
         if (t1.isDateType()) {
-            if (t2.isDateType() || t2.isStringType()) {
-                return true;
-            }
-            return false;
+            return t2.isDateType() || t2.isStringType();
         } else if (t2.isDateType()) {
-            if (t1.isStringType()) {
-                return true;
-            }
-            return false;
+            return t1.isStringType();

Review comment:
       Because t1.isDateType is already checked.

##########
File path: fe/src/main/java/org/apache/doris/analysis/BinaryPredicate.java
##########
@@ -306,6 +300,10 @@ private Type getCmpType() {
             return Type.LARGEINT;
         }
 
+        if ((t1.isNumericType() && t2.isStringType()) || (t1.isStringType() && 
t2.isNumericType())) {
+            return t1.isNumericType() ? Type.fromPrimitiveType(t1) : 
Type.fromPrimitiveType(t2);
+        }

Review comment:
       all the above will both cast to a middle type `DoubleType` and to 
compare, I just handle the situation that compare `Numerical` and  `StringType`




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

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to