vboo123 opened a new pull request, #56690: URL: https://github.com/apache/spark/pull/56690
### What changes were proposed in this pull request? Add TIME data type coverage to the SQL golden-file test suites (`sql-tests`) where DATE and TIMESTAMP already have coverage but TIME did not. This brings TIME to parity with the other temporal types for these suites. No engine or logic changes are included. SQL inputs were added and the `results/` and `analyzer-results/` files were regenerated via `SQLQueryTestSuite` (generated `.out` files are not hand-edited). Per-file changes: - `try_cast.sql` — add `TRY_CAST(... AS TIME)`, valid and invalid cases (invalid returns NULL) - `try_datetime_functions.sql` — add `try_to_time`, mirroring the existing `try_to_timestamp` cases - `datetime-parsing.sql` / `datetime-parsing-invalid.sql` / `datetime-parsing-legacy.sql` — add `to_time` parsing including invalid inputs; the legacy file inherits the cases through its existing `--IMPORT` of `datetime-parsing.sql` - `typeCoercion/native/dateTimeOperations.sql` — add TIME +/- day-time interval and TIME - TIME (which yields INTERVAL HOUR TO SECOND) - `postgreSQL/time.sql` (new) — port analogous to the existing `postgreSQL/date.sql` and `postgreSQL/timestamp.sql` TIME formatting parity in `datetime-formatting.sql` / `datetime-formatting-invalid.sql` / `datetime-formatting-legacy.sql` is intentionally left out of this PR. It depends on the `time_format` function (SPARK-54588), which has not landed yet, and `date_format` / `to_char` do not accept the TIME type, so there is currently no pattern-based way to format a TIME. It will be added as a follow-up once SPARK-54588 merges. ### Why are the changes needed? The TIME type was added by SPIP SPARK-51162 (shipped in Spark 4.1.0) and works in the engine, but it lacked the shared golden-file coverage that DATE and TIMESTAMP have. Adding it locks in correctness for these suites so future changes that regress TIME casting, parsing, or arithmetic are caught automatically. This is a sub-task of the TIME umbrella SPARK-57550. ### Does this PR introduce _any_ user-facing change? No. Test-only change. ### How was this patch tested? Regenerated golden files with `SPARK_GENERATE_GOLDEN_FILES=1 build/sbt "sql/testOnly org.apache.spark.sql.SQLQueryTestSuite"`, then confirmed the suite passes in verify mode (without the regenerate flag) for all touched files: `try_cast.sql`, `try_datetime_functions.sql`, `datetime-parsing*.sql`, `typeCoercion/native/dateTimeOperations.sql`, and `postgreSQL/time.sql`. All passed. ### Was this patch authored or co-authored using generative AI tooling? Yes. Generated using Kiro (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]
