[GitHub] [incubator-doris] wutiangan commented on a change in pull request #3527: [SQL]When compare StringLiteral and Numerical, cast them to Numerical type

2020-05-27 Thread GitBox


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



##
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:
   Can you explain in detail if both input parameters are decimal type., 
why this funciton return decimal 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.

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



[GitHub] [incubator-doris] wutiangan commented on a change in pull request #3527: [SQL]When compare StringLiteral and Numerical, cast them to Numerical type

2020-05-27 Thread GitBox


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



##
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:
   At least equivalent comparison (decimaltype to decimaltype) does not 
need to be converted to double type, You can fix it by the way.





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:
us...@infra.apache.org



-
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org



[GitHub] [incubator-doris] wutiangan commented on a change in pull request #3527: [SQL]When compare StringLiteral and Numerical, cast them to Numerical type

2020-05-26 Thread GitBox


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



##
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:
   why not modify to  “return t1.isDateType() || t1.isStringType()”

##
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:
   what about if "LargeIntType"(16byte) compare "DoubelType"(8byte) ? 
   what about if "DecimalValuetType"(16byte) compare "DoubelType"(8byte)  ? 
   what about if "LargeIntType" compare "DecimalType" ? 
   what about if "DecimalType" compare "DecimalType" ? 





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:
us...@infra.apache.org



-
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org