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 the bug that cannot perform vectorized expression evaluation (#15902) #15956

Merged
merged 7 commits into from
Apr 1, 2020

Conversation

sre-bot
Copy link
Contributor

@sre-bot sre-bot commented Apr 1, 2020

cherry-pick #15902 to release-4.0


What problem does this PR solve?

Related to: #issue15718, #PR15144
It should be possible to perform vectorized expression evaluation when the select statement contains constants

What is changed and how it works?

When the select statement contains constants, it can perform vectorized expression evaluation.
It can be verified by the following example:

drop table tt;
create table tt(a decimal(10, 0), b varchar(1));
insert into tt values(0, '2'), (7, null), (7, '3'), (NULL, 'w'), (NULL, '2'), (NULL, '2'), (NULL, NULL), (7, 'f');

Before this PR:

mysql> select a and b as c, a, b, 1 from tt;
+---+------+------+---+
| c | a    | b    | 1 |
+---+------+------+---+
| 0 |    0 | 2    | 1 |
| NULL |    7 | NULL | 1 |
| 1 |    7 | 3    | 1 |
| 0 | NULL | w    | 1 |
| NULL | NULL | 2    | 1 |
| NULL | NULL | 2    | 1 |
| NULL | NULL | NULL | 1 |
| 0 |    7 | f    | 1 |
+---+------+------+---+
8 rows in set, 2 warnings (0.00 sec)

After this PR: (The answer is wrong. It can be fixed by #15891 )

mysql> select a and b as c, a, b, 1 from tt;
+---+------+------+---+
| c | a    | b    | 1 |
+---+------+------+---+
| 0 |    0 | 2    | 1 |
| 0 |    7 | NULL | 1 |
| 1 |    7 | 3    | 1 |
| 0 | NULL | w    | 1 |
| 0 | NULL | 2    | 1 |
| 0 | NULL | 2    | 1 |
| 0 | NULL | NULL | 1 |
| 0 |    7 | f    | 1 |
+---+------+------+---+
8 rows in set, 2 warnings (0.00 sec)

@sre-bot sre-bot requested a review from a team as a code owner April 1, 2020 08:18
@sre-bot
Copy link
Contributor Author

sre-bot commented Apr 1, 2020

/run-all-tests

Copy link
Contributor

@SunRunAway SunRunAway 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

@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 status/can-merge Indicates a PR has been approved by a committer. label Apr 1, 2020
@sre-bot
Copy link
Contributor Author

sre-bot commented Apr 1, 2020

/run-all-tests

@sre-bot
Copy link
Contributor Author

sre-bot commented Apr 1, 2020

@sre-bot merge failed.

Copy link
Contributor

@AilinKid AilinKid 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
Copy link
Contributor

/merge

@sre-bot
Copy link
Contributor Author

sre-bot commented Apr 1, 2020

Your auto merge job has been accepted, waiting for 15776, 15889, 15926, 15889, 15861, 15955, 15860, 15868, 15907

@zz-jason zz-jason added the status/LGT2 Indicates that a PR has LGTM 2. label Apr 1, 2020
@zz-jason
Copy link
Member

zz-jason commented Apr 1, 2020

/merge

@sre-bot
Copy link
Contributor Author

sre-bot commented Apr 1, 2020

Your auto merge job has been accepted, waiting for 15907

@sre-bot
Copy link
Contributor Author

sre-bot commented Apr 1, 2020

/run-all-tests

@sre-bot
Copy link
Contributor Author

sre-bot commented Apr 1, 2020

@sre-bot merge failed.

@sre-bot
Copy link
Contributor Author

sre-bot commented Apr 1, 2020

/run-all-tests

@sre-bot
Copy link
Contributor Author

sre-bot commented Apr 1, 2020

/run-all-tests

@sre-bot
Copy link
Contributor Author

sre-bot commented Apr 1, 2020

@sre-bot merge failed.

@zz-jason zz-jason merged commit 34ea74b into pingcap:release-4.0 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/4.0-cherry-pick
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants