Skip to content
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

feat(expr, frontend): Impl timestamptz [+-] variable interval #7751

Merged
merged 9 commits into from
Feb 8, 2023

Conversation

jon-chuang
Copy link
Contributor

@jon-chuang jon-chuang commented Feb 8, 2023

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

Handle the date part as naive datetime, and time part as unix milliseconds. This replicates postgres behaviour. We make use of const eval assumption for performance concern.

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • I have added fuzzing tests or opened an issue to track them. (Optional, recommended for new SQL features).
  • I have demonstrated that backward compatibility is not broken by breaking changes and created issues to track deprecated features to be removed in the future. (Please refer the issue)
  • All checks passed in ./risedev check (or alias, ./risedev c)

Refer to a related PR or issue link (optional)

#7334
closes: #5826

@jon-chuang jon-chuang mentioned this pull request Feb 8, 2023
13 tasks
@codecov
Copy link

codecov bot commented Feb 8, 2023

Codecov Report

Merging #7751 (b471ce0) into main (c66e496) will decrease coverage by 0.02%.
The diff coverage is 12.96%.

@@            Coverage Diff             @@
##             main    #7751      +/-   ##
==========================================
- Coverage   71.62%   71.60%   -0.02%     
==========================================
  Files        1098     1098              
  Lines      174694   174739      +45     
==========================================
  Hits       125130   125130              
- Misses      49564    49609      +45     
Flag Coverage Δ
rust 71.60% <12.96%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/expr/src/vector_op/arithmetic_op.rs 43.95% <0.00%> (+0.86%) ⬆️
src/frontend/src/expr/session_timezone.rs 36.02% <13.72%> (-13.98%) ⬇️
src/batch/src/executor/group_top_n.rs 68.23% <0.00%> (-6.48%) ⬇️
src/common/src/types/ordered_float.rs 31.05% <0.00%> (-0.20%) ⬇️
src/stream/src/executor/aggregation/minput.rs 96.24% <0.00%> (-0.11%) ⬇️
src/storage/src/hummock/compactor/mod.rs 80.95% <0.00%> (ø)
src/common/src/cache.rs 97.26% <0.00%> (+0.10%) ⬆️
src/meta/src/hummock/manager/mod.rs 78.29% <0.00%> (+0.12%) ⬆️
src/batch/src/task/task_execution.rs 53.38% <0.00%> (+0.50%) ⬆️
src/meta/src/hummock/mock_hummock_meta_client.rs 65.78% <0.00%> (+1.05%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@xiangjinwu xiangjinwu left a comment

Choose a reason for hiding this comment

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

LGTM!

Comment on lines 63 to 70
# This should first add the days (naively), then the hours, with timezone in mind.
# Daylight savings falls on 2016-10-30 in London timezone
query T
select '2016-10-29 12:00:00'::timestamptz + interval '24 hours' + interval '1 day';
----
2016-10-31 11:00:00+00:00

# This should first add the days (naively), then the hours, with timezone in mind.
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these 2 test cases supposed to have the same comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, they are different, depending on the order of operation, as the interval '24 hours' meaning will change at the daylight saving boundary

Copy link
Contributor

@xiangjinwu xiangjinwu Feb 8, 2023

Choose a reason for hiding this comment

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

So one of the comment is wrong and needs a change, right?

Actually I think it is the meaning of 1 day changed to mean 25 hours during winter backward adjustment "fall back".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, sry, I've changed it. I'll be even more explicit to be clearer.

@mergify mergify bot merged commit b60c0ca into main Feb 8, 2023
@mergify mergify bot deleted the jon/timestamptz-add-interval branch February 8, 2023 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tracking: Exprs blocked by support of implicit TimeZone of session
2 participants