-
Notifications
You must be signed in to change notification settings - Fork 609
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
refactor(types): spilt timestamp to timestamp and timestampnano #20192
base: main
Are you sure you want to change the base?
Conversation
This pull request has been modified. If you want me to regenerate unit test for any of the files related, please find the file in "Files Changed" tab and add a comment |
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.
After this PR, what's the precision of the timestamp
type?
timestamp -> 6 us |
I remembered timestamp should already be nano precision. Does it mean this is a breaking change? |
It was also a breaking change regarding the |
Yes. There should be no compatibility issues with this pr, but it will make some user behavior changes |
I am ok with this PR to keep the timestamp with us precision and introduce a new timestampnano type to introduce nano precision timestamp. It can make the code clearer and it doesn't make too much sense to let |
I agree. I meant this breaking change is acceptable and can actually "fix"/revert a previous breaking change. |
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.
Considering other system nano timestamp type naming conventions, I think it's better to use timestamp_ns
instead of timestampnano
https://arc.net/l/quote/xaiqjmve
https://duckdb.org/docs/sql/data_types/timestamp.html
save fix ci
5492b34
to
776bb4a
Compare
61df181
to
3258b9e
Compare
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.
Summary:
- Stick to
timestamp_ns
. Avoid usingtimestampns
,timestampnano
,timestamp_nano
simultaneously. - We may support operators on
timestamp_ns
in future PRs. A lot of them are missing in this PR, or incorrect, or requirestimestamptz_ns
/time_ns
/interval_ns
before they can be properly implemented. The minimal ones are: being able to write and read (thus from and into string), and cast from/into timestamp, and generic operators that applies to most datatypes (e.g.is null
/case-when
/coalesce
/count
/=
/is distinct from
... See top 2 sections in Tracking: Basic Built-in Functions #112). - For source and sink, either test each case (can be time consuming) or leave them unimplemented.
if subsec_nanosecond % 1_000 != 0 { | ||
return Err(ErrorKind::ParseTimestamp.into()); | ||
} |
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.
PostgreSQL tolerates such lossy parsing, and rounds to even:
test=# select '2020-01-01 12:34:56.123456500'::timestamp;
timestamp
----------------------------
2020-01-01 12:34:56.123456
(1 row)
test=# select '2020-01-01 12:34:56.123457500'::timestamp;
timestamp
----------------------------
2020-01-01 12:34:56.123458
(1 row)
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.
Yes, what's being considered here is restoring rw's very first setting, not sure we want to correct it to pg consistency
@@ -58,6 +58,7 @@ v_bool boolean, | |||
v_date date, | |||
v_timestamp timestamptz, | |||
v_ts_ntz timestamp, | |||
v_timestamp_ns timestamp_ns, |
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.
Did this test pass?
e0b60d6
to
da71941
Compare
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
in #19827, we support timestamp with nano, but we can't support interval with nano in a similar way. So we have to introduce the new type, and correspondingly, we should implement the new type timestamp_nano, so we distinguish between timestamp_nano and timestamp in this pr
Checklist
Documentation
Release note