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: fix wrong result of Not/IsTrue/IsFalse functions #10498

Merged
merged 6 commits into from
Aug 20, 2019

Conversation

eurekaka
Copy link
Contributor

What problem does this PR solve?

Fix #10443

Besides from the case mentioned in the above issue, another wrong result case is:

mysql> select '0.3' is true;
+---------------+
| '0.3' is true |
+---------------+
|             0 |
+---------------+
1 row in set (0.00 sec)

What is changed and how it works?

  • For IsTrue/IsFalse, if the argument type is string or json, do not convert it to int, add new builtin function signature for string types;
  • For Not, convert its evaluation to use IsFalse and IsNull;

Check List

Tests

  • Unit test: will be added later
  • Integration test: will be added later

Code changes

  • Has exported variable/fields change
  • Has interface methods change

Side effects

  • Increased code complexity

Related changes

  • Need to cherry-pick to the release branch

@codecov
Copy link

codecov bot commented Jul 1, 2019

Codecov Report

Merging #10498 into master will not change coverage.
The diff coverage is n/a.

@@             Coverage Diff             @@
##             master     #10498   +/-   ##
===========================================
  Coverage   81.5496%   81.5496%           
===========================================
  Files           435        435           
  Lines         94058      94058           
===========================================
  Hits          76704      76704           
  Misses        11883      11883           
  Partials       5471       5471

@eurekaka
Copy link
Contributor Author

/run-all-tests

@eurekaka
Copy link
Contributor Author

/run-unit-test

expression/builtin_op.go Outdated Show resolved Hide resolved
expression/builtin_op.go Outdated Show resolved Hide resolved
expression/builtin_op.go Outdated Show resolved Hide resolved
expression/builtin_op.go Outdated Show resolved Hide resolved
Copy link
Contributor

@lonng lonng left a comment

Choose a reason for hiding this comment

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

LGTM

expression/builtin_op.go Outdated Show resolved Hide resolved
@eurekaka eurekaka added the status/LGT1 Indicates that a PR has LGTM 1. label Aug 19, 2019
@eurekaka eurekaka requested a review from zz-jason August 19, 2019 09:12
expression/builtin_op.go Outdated Show resolved Hide resolved
expression/builtin_op.go Outdated Show resolved Hide resolved
expression/builtin_op.go Outdated Show resolved Hide resolved
@eurekaka eurekaka requested a review from zz-jason August 20, 2019 02:41
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

@zz-jason zz-jason added status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Aug 20, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Aug 20, 2019

/run-all-tests

@zz-jason
Copy link
Member

should we cherry pick this pr to release 3.0 and 2.1?

@sre-bot
Copy link
Contributor

sre-bot commented Aug 20, 2019

@eurekaka merge failed.

@zz-jason
Copy link
Member

/run-integration-common-test

@zz-jason zz-jason merged commit 5ee0847 into pingcap:master Aug 20, 2019
@eurekaka eurekaka deleted the not_round branch August 21, 2019 08:36
@eurekaka
Copy link
Contributor Author

@zz-jason if we cherry-pick this PR, we need to cherry-pick commits in tipb (which has no release branch at all?) and tikv as well...

@zz-jason
Copy link
Member

Yeah, that's a huge work.

eurekaka added a commit to eurekaka/tidb that referenced this pull request Mar 31, 2020
eurekaka added a commit to eurekaka/tidb that referenced this pull request Mar 31, 2020
eurekaka added a commit to eurekaka/tidb that referenced this pull request Apr 1, 2020
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/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Evaluation error with Logical Not on Decimal Values
5 participants