You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2023/01/09 06:50:31 UTC

[doris] branch master updated: [fix](Nereids) divide operator return type is not same with lagecy planner (#15707)

This is an automated email from the ASF dual-hosted git repository.

morrysnow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 4f2bea86ee [fix](Nereids) divide operator return type is not same with lagecy planner (#15707)
4f2bea86ee is described below

commit 4f2bea86eeb723c7f81353e331c440b4408ee9e5
Author: morrySnow <10...@users.noreply.github.com>
AuthorDate: Mon Jan 9 14:50:24 2023 +0800

    [fix](Nereids) divide operator return type is not same with lagecy planner (#15707)
---
 .../org/apache/doris/nereids/trees/expressions/Divide.java  | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/Divide.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/Divide.java
index 03782fb35a..c5beaf69d3 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/Divide.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/Divide.java
@@ -20,6 +20,9 @@ package org.apache.doris.nereids.trees.expressions;
 import org.apache.doris.analysis.ArithmeticExpr.Operator;
 import org.apache.doris.nereids.exceptions.UnboundException;
 import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor;
+import org.apache.doris.nereids.types.DataType;
+import org.apache.doris.nereids.types.DecimalV2Type;
+import org.apache.doris.nereids.types.DoubleType;
 import org.apache.doris.nereids.types.coercion.AbstractDataType;
 import org.apache.doris.nereids.types.coercion.NumericType;
 
@@ -52,6 +55,16 @@ public class Divide extends BinaryArithmetic {
         return NumericType.INSTANCE;
     }
 
+    @Override
+    public DataType getDataType() throws UnboundException {
+        DataType commonType = super.getDataType();
+        if (commonType.isDecimalType()) {
+            return DecimalV2Type.SYSTEM_DEFAULT;
+        } else {
+            return DoubleType.INSTANCE;
+        }
+    }
+
     // Divide is implemented as a scalar function which return type is always nullable.
     @Override
     public boolean nullable() throws UnboundException {


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