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

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


The following commit(s) were added to refs/heads/master by this push:
     new 8642fa3  [Bug] Double/Float % 0 should be NULL (#8230)
8642fa3 is described below

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

    [Bug] Double/Float % 0 should be NULL (#8230)
    
    Co-authored-by: lihaopeng <lihaop...@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-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to