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

Fix hash for double and real types when new nan is disabled #23060

Merged
merged 1 commit into from
Jun 24, 2024

Conversation

rschlussel
Copy link
Contributor

@rschlussel rschlussel commented Jun 24, 2024

Description

The hash function wasn't gated by the use-new-nan-definition field, which meant it returned different results for -0 (which in the new definition is the same as +0, and in the old definition was not).

This also changes the method call for the real hash function with use-new-nan-definition enabled, but the two functions have the same implementation, so the change is purely for clarity/consistency.

Motivation and Context

Fixes a bug

Impact

Fixes a bug in the hash function for double/real types for -0 when use-new-nan-definition is false. It will incorrectly hash -0 to the same value as 0, which should only happen when use-new-nan-definition is true.

Test Plan

Added unit tests

Contributor checklist

  • Please make sure your submission complies with our development, formatting, commit message, and attribution guidelines.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.

Release Notes

Please follow release notes guidelines and fill in the release notes below.

== RELEASE NOTES ==

General Changes
* Fix a bug in the hash code of -0 for double and real types when ``use-new-nan-definition`` is false :pr:`23060`

The hash function wasn't gated by the use-new-nan-definition field,
which meant it returned different results for -0 (which in the new
definition is the same as +0, and in the old definition was not).

This also changes the method call for the real hash function with
use-new-nan-definition enabled, but the two functions have the same
implementation, so the change is purely for clarity/consistency.
@rschlussel rschlussel requested a review from a team as a code owner June 24, 2024 14:50
Copy link
Contributor

@amitkdutta amitkdutta left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks @rschlussel

@steveburnett
Copy link
Contributor

Suggest adding the PR number to the release note entry.

== RELEASE NOTES ==

General Changes
* Fix a bug in the hash code of -0 for double and real types when ``use-new-nan-definition`` is false :pr:`23060`

@rschlussel rschlussel merged commit 5ed9da6 into prestodb:master Jun 24, 2024
54 checks passed
@tdcmeehan tdcmeehan mentioned this pull request Aug 23, 2024
34 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants