fix: round_even for floats for the single argument case#22344
Open
tarekakrout2021 wants to merge 1 commit into
Open
fix: round_even for floats for the single argument case#22344tarekakrout2021 wants to merge 1 commit into
tarekakrout2021 wants to merge 1 commit into
Conversation
0a5bc20 to
18a70a7
Compare
Contributor
|
Thank you @tarekakrout2021 for working on this, I think we are having a discussion about whether we should opt for PG compatibility just to follow one engine over another, since DuckDb already has the same behavior as Datafusion and it's not the case of one is wrong and the other is right. I think we should keep current behavior unless there is a strong reason to change it. Let's keep the PR open for more discussion. |
Author
|
That makes sense, thanks for taking the time to review this @kumarUjjawal . If the direction shifts toward exposing a separate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
round(float8)should match PostgreSQL half-tie behavior #22269.Rationale for this change
round(float8) should match PostgreSQL half-tie behavior (banker's rounding / round-half-to-even).
What changes are included in this PR?
zero-decimal / single-argument case only
support round(double precision, int) — that form operates on numeric types
(2.5, 3.5, -2.5, -3.5)
Are these changes tested?
Ran:
cargo test --package datafusion-functions roundand
Are there any user-facing changes?
Yes — round(x) where x is a float and x is a half-tie value (e.g. 0.5, 1.5, 2.5)
will now return a different result. This is a correctness fix to match PostgreSQL behavior.
To run the CI : @kumarUjjawal