Skip to content

Commit

Permalink
[oap-native-sql] return null when dividing by zero (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
rui-mo authored and zhouyuan committed Feb 3, 2021
1 parent c45b759 commit 323e155
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions cpp/src/gandiva/precompiled/arithmetic_ops.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<gdv_##TYPE>(NULL); \
} \
return static_cast<gdv_##TYPE>(in1 / in2); \
}
Expand Down

0 comments on commit 323e155

Please sign in to comment.