prestodb / presto

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

Tighten checks for "bins" elements in width_bucket(x, bins) #24103

Closed spershin closed 5 days ago

spershin commented 1 week ago

Description

Make width_bucket(x, bins) throw error if it finds a null or non-finite element in bins.

Motivation and Context

Solves https://github.com/prestodb/presto/issues/24055

Impact

Changes behavior of width_bucket(x, bins) which previously was treating all null elements in bins as zero. Now the function will throw an error.

Test Plan

Updated unit test to handle few cases with nulls.

Contributor checklist

Release Notes

== RELEASE NOTES ==
General Changes
* Fix behavior of :func:`width_bucket(x, bins) -> bigint` which previously treated all ``null`` elements in bins as ``0``. Now the function will throw an error if it finds a ``null`` or non-finite element in ``bins``..  :pr:`24103`
steveburnett commented 6 days ago

Because this PR changes user-facing behavior, I think we should consider a release note entry for this PR. Perhaps something like:

== RELEASE NOTES ==
General Changes
* Fix behavior of :func:`width_bucket(x, bins) -> bigint` which previously treated all ``null`` elements in bins as ``0``. Now the function will throw an error.  :pr:`24103`

(I did a local doc build to verify that :func:width_bucket(x, bins) -> bigint generates a working link from a file in /release/ to this function in functions/math.rst.)

prestodb-ci commented 6 days ago

Saved that user @spershin is from Meta

steveburnett commented 5 days ago

Nit on the formatting of the release note entry - please add a row of three ` above and below the release note block. Like this:

== RELEASE NOTES ==

General Changes
* Fix behavior of :func:`width_bucket(x, bins) -> bigint` which previously treated all ``null`` elements in bins as ``0``. Now the function will throw an error if it finds a ``null`` or non-finite element in ``bins``..  :pr:`24103`