jatinkumarsingh opened a new pull request, #19031: URL: https://github.com/apache/datafusion/pull/19031
Add time scalar functions: make_time, to_time, and date_bin support for Time64 ## Which issue does this PR close? - Closes #19025 ## Rationale for this change The time and date scalar functions were missing support for Time datatypes, making it difficult to work with time values. Users couldn't easily create time fields from components, parse time strings directly, or bin time values. This PR adds the missing functionality to improve time handling in DataFusion. ## What changes are included in this PR? - **make_time**: New function to create `Time64(Nanosecond)` from hour, minute, and second components - **to_time**: New function to parse time strings directly to `Time64(Nanosecond)`, supporting both time-only strings (e.g., '14:30:45') and full timestamps (extracts time component) - **date_bin**: Extended to support `Time64` datatype for time binning operations, allowing users to bin time values similar to timestamps - Updated documentation in `scalar_functions.md` with examples for all new functions ## Are these changes tested? Yes. All functions include comprehensive unit tests: - `make_time`: Tests for scalar and array inputs, null handling, and various input types (Int32, Int64, UInt32, UInt64, Utf8) - `to_time`: Tests for time-only strings, full timestamps, null handling, and formatted parsing - `date_bin`: Updated existing tests to verify Time64 support works correctly All 42 datetime tests pass successfully. ## Are there any user-facing changes? Yes. This PR adds three new user-facing features: 1. `make_time(hour, minute, second)` - Creates a time value from components 2. `to_time(expression[, format_n])` - Converts strings to time values 3. `date_bin(interval, time_value, origin)` - Now supports Time64 inputs in addition to timestamps -- 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]
