From 8642fa38b9ed53184e41f3e03d98ff0d4d652d1d Mon Sep 17 00:00:00 2001 From: HappenLee Date: Fri, 25 Feb 2022 11:03:42 +0800 Subject: [PATCH] [Bug] Double/Float % 0 should be NULL (#8230) Co-authored-by: lihaopeng --- 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 06546c2c95..dc4399b0f0 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));