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 incorrect result of logical operators (#12173) #12811

Conversation

SunRunAway
Copy link
Contributor

@SunRunAway SunRunAway commented Oct 18, 2019

Automated cherry pick of #12173 on release-3.0.


What problem does this PR solve?

Fix issue #11199

TiDB> SELECT NULL OR 0.00000001000000000000;
+--------------------------------+
| NULL OR 0.00000001000000000000 |
+--------------------------------+
|                              1 |
+--------------------------------+
1 row in set (0.00 sec)

TiDB> SELECT 0 OR 0.00000001000000000000;
+-----------------------------+
| 0 OR 0.00000001000000000000 |
+-----------------------------+
|                           1 |
+-----------------------------+
1 row in set (0.00 sec)

TiDB> SELECT 0 OR "0.01a";
+--------------+
| 0 OR "0.01a" |
+--------------+
|            1 |
+--------------+
1 row in set, 1 warning (0.00 sec)

What is changed and how it works?

Wrap the input parameters of the builtin ANDOR and XOR operators with IS TRUE function before cast them to int type.

Check List

Tests

  • Unit test

Code changes

Side effects

Related changes

Release note

  • fix incorrect result of logical operators (OR, AND)

@SunRunAway SunRunAway force-pushed the automated-cherry-pick-of-#12173-upstream-release-3.0 branch from 152f3c4 to 8096263 Compare October 18, 2019 07:19
@SunRunAway
Copy link
Contributor Author

/run-all-tests

@SunRunAway SunRunAway requested review from zz-jason, XuHuaiyu, qw4990 and eurekaka and removed request for zz-jason October 18, 2019 07:40
Copy link
Contributor

@XuHuaiyu XuHuaiyu left a comment

Choose a reason for hiding this comment

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

LGTM

@SunRunAway SunRunAway added the priority/release-blocker This issue blocks a release. Please solve it ASAP. label Oct 18, 2019
@zimulala zimulala added status/all tests passed status/LGT2 Indicates that a PR has LGTM 2. labels Oct 18, 2019
Copy link
Contributor

@eurekaka eurekaka left a comment

Choose a reason for hiding this comment

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

LGTM

@eurekaka eurekaka merged commit 93f8151 into pingcap:release-3.0 Oct 18, 2019
@SunRunAway SunRunAway deleted the automated-cherry-pick-of-#12173-upstream-release-3.0 branch October 18, 2019 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/expression priority/release-blocker This issue blocks a release. Please solve it ASAP. 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.

4 participants