Skip to content

Conversation

@KKould
Copy link
Member

@KKould KKould commented Oct 26, 2025

I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/

Summary

add new DataType TimestampTz, Used to record time zone offset based on Timestamp. Timestmap times in different time zones can exist in the same column.

example:

CREATE TABLE IF NOT EXISTS t3(a Boolean, b Timestamp, c Date, d Array(Int), e Tuple(Int, String), f Timestamp With Time Zone) Engine = fuse STORAGE_FORMAT = 'native';

INSERT INTO t3 (a,b,c,d,e,f) values(true, '2021-09-07 21:38:35.000000', '2021-09-07', [1, 2, 3], (10, 'abc'), '2024-10-22 12:00:00+0900'), (false, 1631050715000000, 18877, [4, 5, 6], (20, 'xyz'), '2024-10-22 12:00:00');

SELECT * FROM t3 order by a desc;
----
1 2021-09-07 21:38:35.000000 2021-09-07 [1,2,3] (10,'abc') 2024-10-22 21:00:00.000000 +0900
0 2021-09-07 21:38:35.000000 2021-09-07 [4,5,6] (20,'xyz') 2024-10-22 12:00:00.000000 +0000

TODO:

  • cast timestamp and timestamp timezone
select to_timestamp_tz(to_timestamp('2021-12-20 17:01:01.000000'))::STRING
----
2021-12-20 17:01:01.000000 +0800

select to_timestamp(to_timestamp_tz('2021-12-20 17:01:01.000000 +0000'))
----
2021-12-21 01:01:01.000000
  • support Interval calculation
SELECT to_interval('1 day') + TIMESTAMP_TZ '1992-01-01 10:00:00 +0800'
----
1992-01-02 10:00:00.000000 +0800
  • add meta test

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

@github-actions github-actions bot added the pr-feature this PR introduces a new feature to the codebase label Oct 26, 2025
@KKould KKould force-pushed the feat/timestamp_timezone branch from 5c54d41 to 7a40323 Compare October 26, 2025 17:08
@wubx
Copy link
Member

wubx commented Oct 27, 2025

https://docs.snowflake.com/en/sql-reference/data-types-datetime#timestamp-ltz-timestamp-ntz-timestamp-tz
Look over the manual: 'timetamp_tz' is synonymous with:

  • TIMESTAMPTZ
  • TIMESTAMP WITH TIME ZONE
    Use timestamp_tz as key work is better by design.

@KKould KKould changed the title feat: support DataType TimestampTimezone feat: support DataType TimestampTz Oct 28, 2025
@KKould KKould force-pushed the feat/timestamp_timezone branch from 76c36c8 to 582708f Compare October 28, 2025 03:05
@KKould KKould force-pushed the feat/timestamp_timezone branch from 793d92b to c4f3fc5 Compare October 28, 2025 06:01
@KKould KKould marked this pull request as ready for review October 28, 2025 07:28
@KKould KKould requested a review from drmingdrmer as a code owner October 28, 2025 07:28
@KKould KKould requested a review from sundy-li October 28, 2025 07:28
@KKould KKould self-assigned this Oct 28, 2025
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.

ℹ️ 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
Member

@drmingdrmer drmingdrmer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@drmingdrmer reviewed 11 of 88 files at r1, all commit messages.
Reviewable status: 11 of 88 files reviewed, 1 unresolved discussion (waiting on @KKould and @sundy-li)

@KKould KKould merged commit 69269a0 into databendlabs:main Oct 29, 2025
168 of 171 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.

4 participants