Skip to content

Conversation

@lmatz
Copy link
Contributor

@lmatz lmatz 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?

As per the title.

Right now, both x and y are casted into Float64 when pow(x, y).
By PG's standard, we also need to support Decimal but Decimal has no built-in pow and we may also change the underlying crate for Decimal. So we leave it aside for now.

Urgently requested by user.

#7725

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). Tracking: Sqlsmith extras #7329
  • 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)

Documentation

If your pull request contains user-facing changes, please specify the types of the changes, and create a release note. Otherwise, please feel free to remove this section.

Types of user-facing changes

Please keep the types that apply to your changes, and remove those that do not apply.

  • SQL functions

Release note

Please create a release note for your changes. In the release note, focus on the impact on users, and mention the environment or conditions where the impact may occur.

pow is a mathematical function, see https://www.postgresql.org/docs/7.4/functions-math.html
But this PR only implements for dp(double precision) as function parameters. Decimal has not been implemented yet.

Refer to a related PR or issue link (optional)

#7725

@github-actions github-actions bot added the type/feature Type: New feature. label Feb 8, 2023
@lmatz lmatz marked this pull request as ready for review February 8, 2023 10:48
@lmatz lmatz added the user-facing-changes Contains changes that are visible to users label Feb 8, 2023
@codecov
Copy link

codecov bot commented Feb 8, 2023

Codecov Report

Merging #7789 (672deb9) into main (e1408c4) will decrease coverage by 0.01%.
The diff coverage is 11.76%.

@@            Coverage Diff             @@
##             main    #7789      +/-   ##
==========================================
- Coverage   71.68%   71.67%   -0.01%     
==========================================
  Files        1100     1100              
  Lines      175690   175707      +17     
==========================================
- Hits       125937   125936       -1     
- Misses      49753    49771      +18     
Flag Coverage Δ
rust 71.67% <11.76%> (-0.01%) ⬇️

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

Impacted Files Coverage Δ
src/common/src/types/ordered_float.rs 31.06% <0.00%> (-0.19%) ⬇️
src/expr/src/expr/expr_binary_nonnull.rs 52.50% <0.00%> (-0.12%) ⬇️
src/expr/src/expr/mod.rs 44.23% <ø> (ø)
src/expr/src/vector_op/arithmetic_op.rs 42.08% <0.00%> (-1.87%) ⬇️
src/expr/src/sig/func.rs 93.91% <100.00%> (+0.02%) ⬆️
src/frontend/src/binder/expr/function.rs 88.75% <100.00%> (+0.02%) ⬆️
src/object_store/src/object/mem.rs 86.48% <0.00%> (-0.78%) ⬇️
...frontend/src/scheduler/hummock_snapshot_manager.rs 60.00% <0.00%> (-0.48%) ⬇️
src/storage/src/hummock/sstable_store.rs 64.57% <0.00%> (-0.32%) ⬇️
src/storage/src/hummock/compactor/iterator.rs 97.95% <0.00%> (-0.30%) ⬇️
... and 4 more

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

}

#[inline(always)]
pub fn general_pow<T1, T2, T3>(l: T1, r: T2) -> Result<T3>
Copy link
Contributor

Choose a reason for hiding this comment

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

If we cast them in frontend, I guess we can only support a concrete implementation (f64,f64)->f64 instead of a general one.

Copy link
Collaborator

Choose a reason for hiding this comment

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

At least the Decimal version needs to be implemented besides the f64 version.

image

Copy link
Contributor

@st1page st1page left a comment

Choose a reason for hiding this comment

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

LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/feature Type: New feature. user-facing-changes Contains changes that are visible to users

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants