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): support sign and distinguish is_positive vs is_sign_positive #10819

Merged
merged 3 commits into from
Jul 10, 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?

Support PostgreSQL expression sign for decimal and double precision (Resolves #8900). Input numeral of other types would be implicitly casted to double precision as in PostgreSQL.

It does not map to rust signum directly:

value sign signum is_positive is_negative is_sign_positive is_sign_negative num_traits is_positive num_traits is_negative
-0.0 0 -1 x x false true false true
0.0 0 1 x x true false true false
0 0 0 false false x x false false

Given that num_traits::Signed confuses between is_positive and is_sign_positive. We removed its usage.

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

Support PostgreSQL expression sign for decimal and double precision.

@github-actions github-actions bot added type/feature user-facing-changes Contains changes that are visible to users labels Jul 7, 2023
@xiangjinwu xiangjinwu marked this pull request as draft July 7, 2023 06:45
@xiangjinwu

This comment was marked as resolved.

@xiangjinwu xiangjinwu marked this pull request as ready for review July 7, 2023 07:53
@codecov
Copy link

codecov bot commented Jul 7, 2023

Codecov Report

Merging #10819 (90bfe60) into main (b70987e) will increase coverage by 0.00%.
The diff coverage is 27.58%.

@@           Coverage Diff           @@
##             main   #10819   +/-   ##
=======================================
  Coverage   70.07%   70.08%           
=======================================
  Files        1300     1300           
  Lines      222084   222034   -50     
=======================================
- Hits       155628   155615   -13     
+ Misses      66456    66419   -37     
Flag Coverage Δ
rust 70.08% <27.58%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
src/common/src/types/decimal.rs 66.43% <0.00%> (+2.60%) ⬆️
src/common/src/types/interval.rs 81.18% <ø> (-0.06%) ⬇️
src/common/src/types/num256.rs 72.78% <ø> (+2.44%) ⬆️
src/expr/src/vector_op/round.rs 92.50% <ø> (ø)
src/frontend/src/expr/pure.rs 93.44% <ø> (ø)
src/expr/src/vector_op/arithmetic_op.rs 65.67% <27.77%> (-1.59%) ⬇️
src/common/src/types/ops.rs 100.00% <100.00%> (ø)
src/common/src/types/ordered_float.rs 51.30% <100.00%> (+0.91%) ⬆️
src/frontend/src/binder/expr/function.rs 85.23% <100.00%> (+0.01%) ⬆️

... and 1 file with indirect coverage changes

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

@xiangjinwu xiangjinwu requested a review from BugenZhao July 7, 2023 08:23
Copy link
Member

@BugenZhao BugenZhao 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 10, 2023
Merged via the queue into main with commit 3990210 Jul 10, 2023
@xiangjinwu xiangjinwu deleted the feat-expr-sign branch July 10, 2023 05:12
@emile-00 emile-00 added the 📖✓ Covered or will be covered in the user docs. label Jul 10, 2023
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 📖✓ Covered or will be covered in the user docs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement the sign function
3 participants