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): add to_date function #11241

Merged
merged 9 commits into from
Aug 1, 2023
Merged

feat(expr): add to_date function #11241

merged 9 commits into from
Aug 1, 2023

Conversation

wangrunji0408
Copy link
Contributor

@wangrunji0408 wangrunji0408 commented Jul 26, 2023

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

What's changed and what's your intention?

resolve #11226

The expr_to_date_const_tmpl.rs is copied from expr_to_timestamp_const_tmpl.rs, which will be simplified in the following refactor #11134.

It also fixes the format of date with negative year.

- -2022-12-25
+ 2022-12-25 BC

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.
Click here for Documentation

Types of user-facing changes

Please keep the types that apply to your changes, and remove the others.

  • SQL commands, functions, and operators

Release note

Add function to_date ( text, text ) → date
Converts string to date according to the given format.
Example: to_date('05 Dec 2000', 'DD Mon YYYY') → 2000-12-05

Signed-off-by: Runji Wang <wangrunji0408@163.com>
Signed-off-by: Runji Wang <wangrunji0408@163.com>
Signed-off-by: Runji Wang <wangrunji0408@163.com>
Signed-off-by: Runji Wang <wangrunji0408@163.com>
@github-actions github-actions bot added type/feature user-facing-changes Contains changes that are visible to users labels Jul 26, 2023
@codecov
Copy link

codecov bot commented Jul 28, 2023

Codecov Report

Merging #11241 (5839578) into main (a84d8e1) will decrease coverage by 0.02%.
Report is 7 commits behind head on main.
The diff coverage is 43.51%.

@@            Coverage Diff             @@
##             main   #11241      +/-   ##
==========================================
- Coverage   69.79%   69.77%   -0.02%     
==========================================
  Files        1359     1360       +1     
  Lines      225851   225946      +95     
==========================================
+ Hits       157630   157652      +22     
- Misses      68221    68294      +73     
Flag Coverage Δ
rust 69.77% <43.51%> (-0.02%) ⬇️

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

Files Changed Coverage Δ
src/expr/src/expr/mod.rs 62.96% <ø> (ø)
src/frontend/src/expr/pure.rs 93.44% <ø> (ø)
src/expr/src/expr/expr_to_date_const_tmpl.rs 1.88% <1.88%> (ø)
src/expr/src/vector_op/to_timestamp.rs 53.65% <28.57%> (-11.21%) ⬇️
src/common/src/types/datetime.rs 58.88% <50.00%> (-1.49%) ⬇️
src/expr/src/vector_op/to_char.rs 85.71% <100.00%> (+9.52%) ⬆️
src/frontend/src/binder/expr/function.rs 85.55% <100.00%> (+0.01%) ⬆️

... and 3 files with indirect coverage changes

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

proto/expr.proto Outdated Show resolved Hide resolved
src/common/src/types/datetime.rs Outdated Show resolved Hide resolved
Signed-off-by: Runji Wang <wangrunji0408@163.com>
Signed-off-by: Runji Wang <wangrunji0408@163.com>
Signed-off-by: Runji Wang <wangrunji0408@163.com>
@wangrunji0408 wangrunji0408 added this pull request to the merge queue Aug 1, 2023
Merged via the queue into main with commit 2637dbd Aug 1, 2023
7 of 8 checks passed
@wangrunji0408 wangrunji0408 deleted the wrj/to_date branch August 1, 2023 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/feature user-facing-changes Contains changes that are visible to users
Projects
None yet
Development

Successfully merging this pull request may close these issues.

implement to_date(varchar, varchar) -> date
2 participants