stevomitric opened a new pull request, #58706:
URL: https://github.com/apache/spark/pull/58706

   
   ### What changes were proposed in this pull request?
   Make `width_bucket` accept the TIME data type. It already supports DOUBLE 
and interval (year-month / day-time) operands. This PR adds TIME, which is 
physically a Long (nanoseconds since midnight) and reuses the existing 
double-based bucket math (no eval/codegen change).
   
   Mixed TIME precisions are allowed and compared on the shared nanos-of-day 
value.
   
   ### Why are the changes needed?
   DATE/TIMESTAMP get equiwidth bucketing through intervals, but a TIME column 
could not be bucketed (e.g. bucketing event times across a 09:00–17:00 workday).
   
   ### Does this PR introduce _any_ user-facing change?
   Yes. `width_bucket(TIME'12:00:00', TIME'09:00:00', TIME'17:00:00', 8)` now 
returns 4 instead of raising an error.
   
   
   ### How was this patch tested?
   `MathExpressionsSuite` unit cases and golden cases in `time.sql` (bucket 
edges, reversed range, mixed precision, and null/degenerate inputs).
   
   
   ### Was this patch authored or co-authored using generative AI tooling?
   Co-Authored-By: Claude Opus 4.8
   


-- 
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]

Reply via email to