Skip to content

Commit

Permalink
[oap-native-sql] return null when dividing by zero (apache#87)
Browse files Browse the repository at this point in the history
rui-mo authored Aug 18, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 661ddbe commit 89f8b76
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
@@ -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); \
}

0 comments on commit 89f8b76

Please sign in to comment.