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) #12813

Conversation

SunRunAway
Copy link
Contributor

@SunRunAway SunRunAway commented Oct 18, 2019

Automated cherry pick of #12173 on release-2.1.


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)

@zyxbest
Copy link
Contributor

zyxbest commented Oct 18, 2019

/run-all-tests

@SunRunAway SunRunAway force-pushed the automated-cherry-pick-of-#12173-upstream-release-2.1 branch from 88d14fe to 0264ab5 Compare October 18, 2019 07:18
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

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

@eurekaka eurekaka added the status/can-merge Indicates a PR has been approved by a committer. label Oct 18, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Oct 18, 2019

/run-all-tests

@sre-bot sre-bot merged commit e848851 into pingcap:release-2.1 Oct 18, 2019
@SunRunAway SunRunAway deleted the automated-cherry-pick-of-#12173-upstream-release-2.1 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 status/can-merge Indicates a PR has been approved by a committer. type/bug-fix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants