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 2022/02/26 09:19:11 UTC

[incubator-doris] 02/06: [Bug] Double/Float % 0 should be NULL (#8230)

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

morningman pushed a commit to branch dev-1.0.0
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git

commit fc7437683d88a4c069ee7958ad9c57be172f4575
Author: HappenLee <ha...@hotmail.com>
AuthorDate: Fri Feb 25 11:03:42 2022 +0800

    [Bug] Double/Float % 0 should be NULL (#8230)
    
    Co-authored-by: lihaopeng <li...@baidu.com>
---
 be/src/exprs/arithmetic_expr.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/be/src/exprs/arithmetic_expr.cpp b/be/src/exprs/arithmetic_expr.cpp
index 06546c2..dc4399b 100644
--- a/be/src/exprs/arithmetic_expr.cpp
+++ b/be/src/exprs/arithmetic_expr.cpp
@@ -113,7 +113,7 @@ FloatVal ModExpr::get_float_val(ExprContext* context, TupleRow* row) {
         return FloatVal::null();
     }
     FloatVal v2 = _children[1]->get_float_val(context, row);
-    if (v2.is_null) {
+    if (v2.is_null || v2.val == 0) {
         return FloatVal::null();
     }
     return FloatVal(fmod(v1.val, v2.val));
@@ -125,7 +125,7 @@ DoubleVal ModExpr::get_double_val(ExprContext* context, TupleRow* row) {
         return DoubleVal::null();
     }
     DoubleVal v2 = _children[1]->get_double_val(context, row);
-    if (v2.is_null) {
+    if (v2.is_null || v2.val == 0) {
         return DoubleVal::null();
     }
     return DoubleVal(fmod(v1.val, v2.val));

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