We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
ifnull
not null
Is your feature request related to a problem? Please describe:
some framework no-brain generate ifnull(col, x) for all return column even column is not null
ifnull(col, x)
create table ttt (id int not null); explain select ifnull(id, 0) from ttt; +---------------------+----------+------+--------------------------------------------------------------+ | id | count | task | operator info | +---------------------+----------+------+--------------------------------------------------------------+ | Projection_3 | 10000.00 | root | ifnull(test.ttt.id, 0) | | └─TableReader_5 | 10000.00 | root | data:TableScan_4 | | └─TableScan_4 | 10000.00 | cop | table:ttt, range:[-inf,+inf], keep order:false, stats:pseudo | +---------------------+----------+------+--------------------------------------------------------------+ 3 rows in set (0.00 sec)
Describe the feature you'd like:
eliminate ifnull() for not null column.
ifnull()
+-------------------+----------+------+--------------------------------------------------------------+ | id | count | task | operator info | +-------------------+----------+------+--------------------------------------------------------------+ | TableReader_5 | 10000.00 | root | data:TableScan_4 | | └─TableScan_4 | 10000.00 | cop | table:ttt, range:[-inf,+inf], keep order:false, stats:pseudo | +-------------------+----------+------+--------------------------------------------------------------+
Describe alternatives you've considered:
it's better eliminate impl can reduce plan node allocation- -?
Teachability, Documentation, Adoption, Migration Strategy:
mainly useful for some no-brain generate code framework's user.
The text was updated successfully, but these errors were encountered:
Actually, the thing you described contains two step:
Sorry, something went wrong.
@lzmhhh123 PTAL
@lysu I believe the correct plan should be the following:
mysql> explain select ifnull(id, 0), ifnull(id, 1) from ttt; +---------------------+----------+------+--------------------------------------------------------------+ | id | count | task | operator info | +---------------------+----------+------+--------------------------------------------------------------+ | Projection_3 | 10000.00 | root | test.ttt.id | | └─TableReader_5 | 10000.00 | root | data:TableScan_4 | | └─TableScan_4 | 10000.00 | cop | table:ttt, range:[-inf,+inf], keep order:false, stats:pseudo | +---------------------+----------+------+--------------------------------------------------------------+ 3 rows in set (0.00 sec)
Proj can be eliminated later.
lzmhhh123
Successfully merging a pull request may close this issue.
Feature Request
Is your feature request related to a problem? Please describe:
some framework no-brain generate
ifnull(col, x)
for all return column even column is not nullDescribe the feature you'd like:
eliminate
ifnull()
fornot null
column.Describe alternatives you've considered:
it's better eliminate impl can reduce plan node allocation- -?
Teachability, Documentation, Adoption, Migration Strategy:
mainly useful for some no-brain generate code framework's user.
The text was updated successfully, but these errors were encountered: