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

convert join to table dual for false result of constant propagation #7728

Closed
eurekaka opened this issue Sep 17, 2018 · 0 comments
Closed

convert join to table dual for false result of constant propagation #7728

eurekaka opened this issue Sep 17, 2018 · 0 comments
Assignees
Labels
sig/planner SIG: Planner type/enhancement The issue or PR belongs to an enhancement.

Comments

@eurekaka
Copy link
Contributor

Feature Request

Is your feature request related to a problem? Please describe:

create table t1(id int primary key, a int);
create table t2(id int primary key, a int);

mysql> explain select * from t1 join t2 on t1.a = t2.a where t2.a = null;
+-----------------------+-------------+------+-------------------------------------------------------------+
| id                    | count       | task | operator info                                               |
+-----------------------+-------------+------+-------------------------------------------------------------+
| HashLeftJoin_7        | 80000000.00 | root | inner join, inner:TableDual_11                              |
| ├─TableReader_10      | 10000.00    | root | data:TableScan_9                                            |
| │ └─TableScan_9       | 10000.00    | cop  | table:t1, range:[-inf,+inf], keep order:false, stats:pseudo |
| └─TableDual_11        | 8000.00     | root | rows:0                                                      |
+-----------------------+-------------+------+-------------------------------------------------------------+
4 rows in set (0.00 sec)

First, count field should be wrong.
Second, the join should be a table dual.

Describe the feature you'd like:

Check the result of PropagateConstant, if it is always false, convert the plan node to table dual.

Describe alternatives you've considered:

None

Teachability, Documentation, Adoption, Migration Strategy:

None

@eurekaka eurekaka self-assigned this Sep 17, 2018
@eurekaka eurekaka added sig/planner SIG: Planner type/enhancement The issue or PR belongs to an enhancement. labels Sep 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/planner SIG: Planner type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

No branches or pull requests

1 participant