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

expression: avoid unnecessary warnings/errors when folding constants in control expr #19675

Merged
merged 5 commits into from
Sep 9, 2020

Conversation

fzhedu
Copy link
Contributor

@fzhedu fzhedu commented Sep 1, 2020

What problem does this PR solve?

Issue Number: close #17725

following #19367, avoid unnecessary warnings/errors when folding constants in control expr.

Problem Summary:

What is changed and how it works?

Proposal: xxx

What's Changed:

the scalar if is wrong, to be corrected here,
add tryFoldCounter to try fold constrants but not throw warnings/erros.
correct the special handler for control expressions.

How it Works:

each branch of control expressions fold contrants whenever possible, but not throw uncessary warnings/errors. When folding the control expressions, it run the normal branches and return normally like evaluating scalar expressions. If a branch is not const, it will stop folding constrants.

Related changes

  • Need to cherry-pick to the release branch

Check List

Tests

  • Unit test

Release note

  • avoid unnecessary warnings/errors when folding constants in control expr

@fzhedu fzhedu requested review from a team as code owners September 1, 2020 12:42
@fzhedu fzhedu requested review from qw4990 and eurekaka and removed request for a team September 1, 2020 12:42
@fzhedu
Copy link
Contributor Author

fzhedu commented Sep 2, 2020

/run-check_dev_2

@fzhedu fzhedu requested a review from lzmhhh123 September 3, 2020 02:33
@fzhedu
Copy link
Contributor Author

fzhedu commented Sep 3, 2020

/run-check_dev_2

1 similar comment
@fzhedu
Copy link
Contributor Author

fzhedu commented Sep 3, 2020

/run-check_dev_2

Copy link
Contributor

@lzmhhh123 lzmhhh123 left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-srebot ti-srebot added the status/LGT1 Indicates that a PR has LGTM 1. label Sep 8, 2020
Copy link
Contributor

@qw4990 qw4990 left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-srebot ti-srebot removed the status/LGT1 Indicates that a PR has LGTM 1. label Sep 8, 2020
@ti-srebot ti-srebot added the status/LGT2 Indicates that a PR has LGTM 2. label Sep 8, 2020
@qw4990
Copy link
Contributor

qw4990 commented Sep 8, 2020

/merge

@ti-srebot ti-srebot added the status/can-merge Indicates a PR has been approved by a committer. label Sep 8, 2020
@ti-srebot
Copy link
Contributor

Your auto merge job has been accepted, waiting for:

  • 18467

@ti-srebot
Copy link
Contributor

/run-all-tests

@ti-srebot
Copy link
Contributor

@fzhedu merge failed.

Copy link
Member

@zz-jason zz-jason left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-srebot ti-srebot added status/LGT3 The PR has already had 3 LGTM. and removed status/LGT2 Indicates that a PR has LGTM 2. labels Sep 9, 2020
@zz-jason
Copy link
Member

zz-jason commented Sep 9, 2020

/merge

@ti-srebot
Copy link
Contributor

/run-all-tests

@ti-srebot ti-srebot merged commit c022fdc into pingcap:master Sep 9, 2020
ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Sep 9, 2020
@ti-srebot
Copy link
Contributor

cherry pick to release-4.0 in PR #19910

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/expression status/can-merge Indicates a PR has been approved by a committer. status/LGT3 The PR has already had 3 LGTM.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

expression: short-cut expressions cause unnecessary warnings, which even causes errors in update statements.
5 participants