prestodb / presto

The official home of the Presto distributed SQL query engine for big data
http://prestodb.io
Apache License 2.0
15.74k stars 5.28k forks source link

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

Closed rschlussel closed 6 days ago

rschlussel commented 6 days ago

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

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`
steveburnett commented 6 days ago

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`