Skip to content

Conversation

@KKould
Copy link
Member

@KKould KKould commented Jan 4, 2026

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

  • Unit Test
  • Logic Test
  • Benchmark Test
  • No Test - Explain why

Type of change

  • Bug Fix (non-breaking change which fixes an issue)
  • New Feature (non-breaking change which adds functionality)
  • Breaking Change (fix or feature that could cause existing functionality not to work as expected)
  • Documentation Update
  • Refactoring
  • Performance Improvement
  • Other (please describe):

This change is Reviewable

@KKould KKould requested a review from sundy-li January 4, 2026 09:33
@KKould KKould self-assigned this Jan 4, 2026
@KKould KKould requested a review from b41sh January 4, 2026 09:33
@github-actions github-actions bot added the pr-feature this PR introduces a new feature to the codebase label Jan 4, 2026
@KKould KKould requested a review from TCeason January 4, 2026 09:33
@TCeason
Copy link
Collaborator

TCeason commented Jan 4, 2026

Please add Sqllogic test

@KKould KKould marked this pull request as ready for review January 5, 2026 01:45
@KKould
Copy link
Member Author

KKould commented Jan 5, 2026

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a 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".

Copy link
Contributor

Copilot AI left a 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, and is_timestamp_tz functions for variant casting
  • Updates type checking and evaluation logic to handle nullable timestamp_tz types
  • 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.

@b41sh b41sh merged commit 1cbe48f into databendlabs:main Jan 5, 2026
87 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-feature this PR introduces a new feature to the codebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: support variant cast to timestamp_tz

3 participants