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

support eliminating group_concat when group-by-items contain at least one unique column #9968

Open
XuHuaiyu opened this issue Apr 1, 2019 · 0 comments
Labels
feature/accepted This feature request is accepted by product managers type/feature-request Categorizes issue or PR as related to a new feature.

Comments

@XuHuaiyu
Copy link
Contributor

XuHuaiyu commented Apr 1, 2019

Feature Request

Is your feature request related to a problem? Please describe:
Group_concat will not be eliminated after #9967 , and the reason is mentioned in that PR.

Describe the feature you'd like:
Considering system variable group_concat_max_len in CONCAT_WS if it's introduced when eliminating group_concat.
When all the arguments accepted by group_concat are promised to be not-null, we can rewrite it into concat_ws.

mysql> select group_concat(null);
+--------------------+
| group_concat(null) |
+--------------------+
| NULL               |
+--------------------+
1 row in set (0.00 sec)

mysql> select concat_ws(",",null);
+---------------------+
| concat_ws(",",null) |
+---------------------+
|                     |
+---------------------+
1 row in set (0.00 sec)
mysql> select group_concat("abc", null);
+---------------------------+
| group_concat("abc", null) |
+---------------------------+
| NULL                      |
+---------------------------+
1 row in set (0.00 sec)

mysql> select concat_ws(",","abc",null);
+---------------------------+
| concat_ws(",","abc",null) |
+---------------------------+
| abc                       |
+---------------------------+
1 row in set (0.00 sec)

Describe alternatives you've considered:
Add a maxLen attribute whose default value is -1 for concat_ws, and check it to decide whether or not truncate the final result. If it's -1, we would not truncate it.
Set maxLen as group_concat.maxLen when eliminating the group_concat.

Teachability, Documentation, Adoption, Migration Strategy:

@ghost ghost added the type/feature-request Categorizes issue or PR as related to a new feature. label Jul 23, 2020
@zz-jason zz-jason added the feature/accepted This feature request is accepted by product managers label Jul 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/accepted This feature request is accepted by product managers type/feature-request Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

No branches or pull requests

2 participants