Skip to content

fix(spark): mod/pmod returns NULL instead of NaN for float division by zero#21557

Merged
andygrove merged 2 commits intoapache:mainfrom
buraksenn:fix-pmod-mod-returning-nan
Apr 13, 2026
Merged

fix(spark): mod/pmod returns NULL instead of NaN for float division by zero#21557
andygrove merged 2 commits intoapache:mainfrom
buraksenn:fix-pmod-mod-returning-nan

Conversation

@buraksenn
Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

please see issue

What changes are included in this PR?

adjust pmod and mod to return NULL as expected

Are these changes tested?

added and adjusted tests

Are there any user-facing changes?

This methods will return NULL instead of Nan on this specific case.

@github-actions github-actions bot added sqllogictest SQL Logic Tests (.slt) spark labels Apr 11, 2026
Copy link
Copy Markdown
Contributor

@nuno-faria nuno-faria left a comment

Choose a reason for hiding this comment

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

Thanks @buraksenn, I leave just a small suggestion below.

Comment thread datafusion/spark/src/function/math/modulus.rs
Copy link
Copy Markdown
Member

@andygrove andygrove left a comment

Choose a reason for hiding this comment

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

Thanks @buraksenn

@andygrove andygrove added this pull request to the merge queue Apr 13, 2026
Merged via the queue into apache:main with commit 70e7730 Apr 13, 2026
31 checks passed
@buraksenn buraksenn deleted the fix-pmod-mod-returning-nan branch April 14, 2026 07:51
coderfender pushed a commit to coderfender/datafusion that referenced this pull request Apr 14, 2026
…y zero (apache#21557)

## Which issue does this PR close?

- Closes apache#21514.

## Rationale for this change
please see issue 

## What changes are included in this PR?
adjust pmod and mod to return NULL as expected

## Are these changes tested?
added and adjusted tests


## Are there any user-facing changes?
This methods will return NULL instead of Nan on this specific case.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

spark sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: datafusion-spark mod/pmod returns NaN instead of NULL for float division by zero

3 participants