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): do not const-eval impure expressions #9616

Merged
merged 5 commits into from
May 6, 2023

Conversation

BugenZhao
Copy link
Member

Signed-off-by: Bugen Zhao i@bugenzhao.comI hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

Previously we treat an expression tree that only consists of InputRefs and function calls as constant evaluable. This is incorrect if there are impure function calls, for example, PROCTIME(). (#9572)

This PR also makes eval_row_const return an Option to avoid calling is_const multiple times.

Checklist For Contributors

  • 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).
  • 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 to the issue)
  • All checks passed in ./risedev check (or alias, ./risedev c)

Checklist For Reviewers

  • I have requested macro/micro-benchmarks as this PR can affect performance substantially, and the results are shown.

Documentation

  • My PR DOES NOT contain 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.

  • Installation and deployment
  • Connector (sources & sinks)
  • SQL commands, functions, and operators
  • RisingWave cluster configuration changes
  • Other (please specify in the release note below)

Release note

BugenZhao added 2 commits May 5, 2023 17:36
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
@github-actions github-actions bot added the type/fix Bug fix label May 5, 2023
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
@BugenZhao BugenZhao requested a review from yuhao-su May 5, 2023 10:11
src/frontend/src/expr/mod.rs Outdated Show resolved Hide resolved
src/frontend/src/utils/condition.rs Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented May 5, 2023

Codecov Report

Merging #9616 (1b3b746) into main (90a45a5) will increase coverage by 0.00%.
The diff coverage is 94.73%.

@@           Coverage Diff           @@
##             main    #9616   +/-   ##
=======================================
  Coverage   70.73%   70.73%           
=======================================
  Files        1233     1233           
  Lines      206601   206612   +11     
=======================================
+ Hits       146146   146155    +9     
- Misses      60455    60457    +2     
Flag Coverage Δ
rust 70.73% <94.73%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
src/frontend/src/expr/pure.rs 95.00% <ø> (ø)
...frontend/src/optimizer/plan_node/logical_source.rs 70.11% <25.00%> (-0.82%) ⬇️
src/frontend/src/expr/mod.rs 80.48% <100.00%> (+1.14%) ⬆️
...ptimizer/plan_expr_rewriter/const_eval_rewriter.rs 60.86% <100.00%> (-1.64%) ⬇️
...ontend/src/optimizer/plan_node/logical_over_agg.rs 85.60% <100.00%> (+0.11%) ⬆️
...end/src/optimizer/rule/always_false_filter_rule.rs 100.00% <100.00%> (+4.00%) ⬆️
...ontend/src/optimizer/rule/over_agg_to_topn_rule.rs 84.68% <100.00%> (-1.03%) ⬇️
src/frontend/src/utils/condition.rs 94.77% <100.00%> (ø)

... and 7 files with indirect coverage changes

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

Signed-off-by: Bugen Zhao <i@bugenzhao.com>
src/frontend/src/expr/mod.rs Outdated Show resolved Hide resolved
proto/expr.proto Show resolved Hide resolved
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Copy link
Contributor

@liurenjie1024 liurenjie1024 left a comment

Choose a reason for hiding this comment

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

LGTM

@BugenZhao BugenZhao enabled auto-merge May 6, 2023 06:04
@BugenZhao BugenZhao added this pull request to the merge queue May 6, 2023
Merged via the queue into main with commit 445ca8e May 6, 2023
@BugenZhao BugenZhao deleted the bz/do-not-eval-const-impure-funcs branch May 6, 2023 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/fix Bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants