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

fix(expr): to_timestamp should return timestamptz #11018

Merged
merged 1 commit into from
Jul 24, 2023

Conversation

xiangjinwu
Copy link
Contributor

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

What's changed and what's your intention?

Fix #7780

Backward compatibility: The old to_timestamp(varchar, varchar) -> timestamp would not be generated by frontend, but is still accepted by backend, despite lacking the constant template optimization.

Tested locally: (1) create a mview with to_timestamp on main branch; (2) kill the cluster, switch to PR branch, and start cluster; (3) query the mview, insert new rows to its upstream and query again

Given the initial request to support to_timestamp comes from superset, it is likely this expr is not used in a mview yet. If we do find it is necessary to optimize this legacy variant with constant template as well, we can refactor ExprToTimestampConstTmpl with generic.

The following styling issues will be handled in a followup PR:

  • timezone vs time_zone
  • to_timestamp1 -> char_to_timestamptz
  • to_timestamp -> sec_to_timestamptz

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 Sqlsmith: Sql feature generation #7934).
  • My PR contains breaking changes. (If it deprecates some features, please create a tracking issue to remove them in the future).
  • All checks passed in ./risedev check (or alias, ./risedev c)
  • My PR changes performance-critical code. (Please run macro/micro-benchmarks and show the results.)
  • My PR contains critical fixes that are necessary to be merged into the latest release. (Please check out the details)

Documentation

  • My PR contains user-facing changes.

Types of user-facing changes

  • SQL commands, functions, and operators

Release note

to_timestamp(input_string, format) returns timestamptz, aligning with PostgreSQL.

@github-actions github-actions bot added type/fix Bug fix user-facing-changes Contains changes that are visible to users labels Jul 18, 2023
@codecov
Copy link

codecov bot commented Jul 18, 2023

Codecov Report

Merging #11018 (ad95100) into main (ba622f0) will increase coverage by 0.01%.
The diff coverage is 37.89%.

@@            Coverage Diff             @@
##             main   #11018      +/-   ##
==========================================
+ Coverage   69.89%   69.90%   +0.01%     
==========================================
  Files        1312     1312              
  Lines      224186   224266      +80     
==========================================
+ Hits       156700   156779      +79     
- Misses      67486    67487       +1     
Flag Coverage Δ
rust 69.90% <37.89%> (+0.01%) ⬆️

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

Impacted Files Coverage Δ
src/frontend/src/expr/session_timezone.rs 66.17% <0.00%> (-4.14%) ⬇️
src/expr/src/expr/expr_to_timestamp_const_tmpl.rs 2.27% <5.12%> (+0.48%) ⬆️
src/expr/src/vector_op/to_timestamp.rs 64.86% <69.76%> (+64.86%) ⬆️
src/expr/src/expr/build.rs 80.53% <75.00%> (-0.16%) ⬇️
src/common/src/types/timestamptz.rs 74.07% <100.00%> (+3.70%) ⬆️

... and 4 files with indirect coverage changes

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

Copy link
Contributor

@wangrunji0408 wangrunji0408 left a comment

Choose a reason for hiding this comment

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

LGTM!

@xiangjinwu xiangjinwu added this pull request to the merge queue Jul 24, 2023
Merged via the queue into main with commit 62b008b Jul 24, 2023
7 of 8 checks passed
@xiangjinwu xiangjinwu deleted the fix-expr-to-timestamptz branch July 24, 2023 08:18
@emile-00 emile-00 added the 📖✓ Covered or will be covered in the user docs. label Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/fix Bug fix user-facing-changes Contains changes that are visible to users 📖✓ Covered or will be covered in the user docs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: to_timestamp(text, text) should return timestamptz rather than timestamp
3 participants