Skip to content

expression: fix incorrect result of logical operators (#12173)#12810

Merged
sre-bot merged 5 commits intopingcap:release-3.1from
SunRunAway:automated-cherry-pick-of-#12173-upstream-release-3.1
Oct 18, 2019
Merged

expression: fix incorrect result of logical operators (#12173)#12810
sre-bot merged 5 commits intopingcap:release-3.1from
SunRunAway:automated-cherry-pick-of-#12173-upstream-release-3.1

Conversation

@SunRunAway
Copy link
Contributor

@SunRunAway SunRunAway commented Oct 18, 2019

Automated cherry pick of #12173 on release-3.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)

@SunRunAway
Copy link
Contributor Author

/run-unit-test

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

Your auto merge job has been accepted, waiting for 12813

@sre-bot
Copy link
Contributor

sre-bot commented Oct 18, 2019

/run-all-tests

@sre-bot sre-bot merged commit 7c69ca4 into pingcap:release-3.1 Oct 18, 2019
@SunRunAway SunRunAway deleted the automated-cherry-pick-of-#12173-upstream-release-3.1 branch October 18, 2019 09:15
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/bugfix This PR fixes a bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants