From 323e15529ca2ff996f2e3996b9161758a05c149f Mon Sep 17 00:00:00 2001 From: Rui Mo Date: Tue, 18 Aug 2020 09:22:30 +0800 Subject: [PATCH] [oap-native-sql] return null when dividing by zero (#87) --- cpp/src/gandiva/precompiled/arithmetic_ops.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cpp/src/gandiva/precompiled/arithmetic_ops.cc b/cpp/src/gandiva/precompiled/arithmetic_ops.cc index 65d08f36e7d19..4ecc0f4be91f2 100644 --- a/cpp/src/gandiva/precompiled/arithmetic_ops.cc +++ b/cpp/src/gandiva/precompiled/arithmetic_ops.cc @@ -249,9 +249,7 @@ NUMERIC_BOOL_DATE_FUNCTION(IS_NOT_DISTINCT_FROM) FORCE_INLINE \ gdv_##TYPE divide_##TYPE##_##TYPE(gdv_int64 context, gdv_##TYPE in1, gdv_##TYPE in2) { \ if (in2 == 0) { \ - char const* err_msg = "divide by zero error"; \ - gdv_fn_context_set_error_msg(context, err_msg); \ - return 0; \ + return static_cast(NULL); \ } \ return static_cast(in1 / in2); \ }