-
Notifications
You must be signed in to change notification settings - Fork 845
feat: support variant cast to timestamp_tz #19190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Please add Sqllogic test |
|
@codex review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c84eaf6045
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds support for casting variant types to timestamp_tz (timestamp with timezone), addressing issue #19034. The implementation follows the same patterns used for other temporal types like timestamp, date, and interval.
Key changes:
- Adds
to_timestamp_tz,try_to_timestamp_tz,as_timestamp_tz, andis_timestamp_tzfunctions for variant casting - Updates type checking and evaluation logic to handle nullable
timestamp_tztypes - Includes comprehensive unit and SQL logic tests
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/query/expression/src/type_check.rs |
Fixed cast function selection to handle nullable timestamp_tz types by using remove_nullable() |
src/query/expression/src/evaluator.rs |
Added TimestampTz to the lists of supported cast target types from variant |
src/query/functions/src/scalars/variant.rs |
Implemented four new variant functions: is_timestamp_tz, as_timestamp_tz, to_timestamp_tz, and try_to_timestamp_tz, plus helper function cast_to_timestamp_tz |
src/query/functions/tests/it/scalars/variant.rs |
Added unit tests for all new timestamp_tz variant functions |
src/query/functions/tests/it/scalars/testdata/variant.txt |
Generated test output data for the new unit tests |
tests/sqllogictests/suites/query/functions/02_0056_function_semi_structureds_as.test |
Added SQL logic tests for timestamp_tz variant casting and type checking |
tests/sqllogictests/suites/query/functions/02_0002_function_cast.test |
Added SQL logic tests for timestamp_tz casting from JSON including null handling and error cases |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/
Summary
add variant functions for timestamp_tz
Tests
Type of change
This change is