dtenedor opened a new pull request #35735:
URL: https://github.com/apache/spark/pull/35735
### What changes were proposed in this pull request?
This pull request updates the histogram_numeric SQL function to support more
numeric input types, returning the results an an array of structs of two fields
each. The first field has the same type as the first argument to the
histogram_numeric aggregate function (rather than always having double type
before this change). This removes the need for the user to apply a cast
function to the result in order to use it.
Example behavior after this change becomes effective:
SELECT histogram_numeric(col, 3) FROM VALUES (TIMESTAMP '2017-03-01
00:00:00'),
(TIMESTAMP '2017-04-01 00:00:00'), (TIMESTAMP '2017-05-01 00:00:00') AS
tab(col);
Returns type: struct<histogram_numeric(col,
3):array<struct<x:timestamp,y:double>>>.
Query output: [{"x":2017-03-01 00:00:00,"y":1.0},{"x":2017-04-01
00:00:00,"y":1.0},{"x":2017-05-01 00:00:00,"y":1.0}].
### Why are the changes needed?
This removes the need for users to explicitly cast the function result type
in many cases.
### Does this PR introduce _any_ user-facing change?
Yes, it changes the `histogram_numeric` function result type.
### How was this patch tested?
Unit tests, file-based query tests.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]