Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Returns null when divide/mod by 0 #186

Merged

Conversation

jackylee-ch
Copy link

@jackylee-ch jackylee-ch commented Dec 6, 2022

In vanilla Spark, 1/0 returns null rather than 0.0.

@github-actions
Copy link

github-actions bot commented Dec 6, 2022

Thanks for opening a pull request!

If this is not a minor PR. Could you open an issue for this pull request on JIRA? https://issues.apache.org/jira/browse/ARROW

Opening JIRAs ahead of time contributes to the Openness of the Apache Arrow project.

Then could you also rename pull request title in the following format?

ARROW-${JIRA_ID}: [${COMPONENT}] ${SUMMARY}

or

MINOR: [${COMPONENT}] ${SUMMARY}

See also:

@jackylee-ch
Copy link
Author

cc @zhouyuan

@@ -90,7 +90,7 @@ std::vector<NativeFunction> GetArithmeticFunctionRegistry() {
// add/sub/multiply/divide/mod
BINARY_SYMMETRIC_FN(add, {}), BINARY_SYMMETRIC_FN(subtract, {}),
BINARY_SYMMETRIC_FN(multiply, {}),
NUMERIC_TYPES(BINARY_SYMMETRIC_UNSAFE_NULL_IF_NULL, divide, {}),
NUMERIC_TYPES(BINARY_SYMMETRIC_SAFE_INTERNAL_NULL, divide, {}),
BINARY_GENERIC_SAFE_NULL_IF_NULL(mod, {"modulo"}, int8, int8, int8),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you also need to modify the mod func?

@zhouyuan zhouyuan changed the title Returns null when 1 divided by 0 Returns null when divide/mod by 0 Dec 8, 2022
@zhouyuan zhouyuan merged commit 8a0ed51 into oap-project:arrow-4.0.0-oap Dec 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants