Skip to content

[SPARK-57846][SQL] Add the try_make_time function#56932

Open
yadavay-amzn wants to merge 2 commits into
apache:masterfrom
yadavay-amzn:SPARK-57846
Open

[SPARK-57846][SQL] Add the try_make_time function#56932
yadavay-amzn wants to merge 2 commits into
apache:masterfrom
yadavay-amzn:SPARK-57846

Conversation

@yadavay-amzn

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Adds the try_make_time(hour, minute, second) function, the error-safe counterpart to make_time: it returns the same result on valid input and NULL (instead of throwing) on invalid input. It is implemented as TryEval(MakeTime(...)), mirroring try_make_timestamp. Registered in the function registry, exposed via functions.scala, and documented (ANSI-compliance try-functions list + sql-expression-schema).

Why are the changes needed?

make_time throws on invalid components (e.g. hour = 25). Users want a null-returning variant consistent with the other try_* datetime constructors (try_make_timestamp, etc.).

Does this PR introduce any user-facing change?

Yes - a new function try_make_time.

How was this patch tested?

Unit tests (TimeExpressionsSuite), integration (TimeFunctionsSuiteBase), SQL-level (time.sql), and Connect plan-generation goldens: valid input equals make_time, invalid input returns NULL.

Was this patch authored or co-authored using generative AI tooling?

Authored with assistance by Claude Opus 4.8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant