You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2023/01/16 18:01:52 UTC

[GitHub] [doris] morrySnow commented on a diff in pull request #15949: [fix](nereids) fix bug in multiply return data type

morrySnow commented on code in PR #15949:
URL: https://github.com/apache/doris/pull/15949#discussion_r1071485735


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/Multiply.java:
##########
@@ -44,7 +45,11 @@ public Expression withChildren(List<Expression> children) {
 
     @Override
     public DataType getDataType() {
-        return left().getDataType().promotion();
+        DataType rightType = child(0).getDataType();
+        DataType leftType = child(1).getDataType();
+        DataType outputType = TypeCoercionUtils.findTightestCommonType(null,
+                rightType, leftType).orElseGet(() -> rightType);
+        return outputType;

Review Comment:
   maybe we need refer legacy planner to do binary arithmetic type coercion and get data 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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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