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

function: different grouping function will be resolved to a same one because expression action re-usage #7717

Closed
AilinKid opened this issue Jun 28, 2023 · 1 comment · Fixed by #7718
Assignees
Labels
severity/minor type/bug The issue is confirmed as a bug.

Comments

@AilinKid
Copy link
Contributor

AilinKid commented Jun 28, 2023

Bug Report

Please answer these questions before submitting your issue. Thanks!
use tiflash pr: #7169

1. Minimal reproduce step (Required)

MySQL [test]>  select count(1),  grouping(a), grouping(b) from t group by a, b with rollup;
+----------+-------------+-------------+
| count(1) | grouping(a) | grouping(b) |
+----------+-------------+-------------+
|        1 |           0 |           0 |
|        2 |           1 |           1 |
|        2 |           0 |           0 |
|        1 |           0 |           0 |
+----------+-------------+-------------+
4 rows in set (0.072 sec)

MySQL [test]>  select count(1),  grouping(b), grouping(a) from t group by a, b with rollup;
+----------+-------------+-------------+
| count(1) | grouping(b) | grouping(a) |
+----------+-------------+-------------+
|        1 |           0 |           0 |
|        2 |           1 |           1 |
|        1 |           0 |           0 |
|        2 |           1 |           1 |
+----------+-------------+-------------+
4 rows in set (0.063 sec)

2. What did you expect to see? (Required)

MySQL [test]>  select count(1),  grouping(a), grouping(b) from t group by a, b with rollup;
+----------+-------------+-------------+
| count(1) | grouping(a) | grouping(b) |
+----------+-------------+-------------+
|        1 |           0 |           0 |
|        2 |           1 |           1 |
|        2 |           0 |           1 |
|        1 |           0 |           0 |
+----------+-------------+-------------+
4 rows in set (0.072 sec)

MySQL [test]>  select count(1),  grouping(b), grouping(a) from t group by a, b with rollup;
+----------+-------------+-------------+
| count(1) | grouping(b) | grouping(a) |
+----------+-------------+-------------+
|        1 |           0 |           0 |
|        2 |           1 |           0 |
|        1 |           0 |           0 |
|        2 |           1 |           1 |
+----------+-------------+-------------+
4 rows in set (0.063 sec)

3. What did you see instead (Required)

as description shows.

the first encouter-ed grouping function's result will be referred to the second grouping function.

4. What is your TiFlash version? (Required)

master

@AilinKid AilinKid added the type/bug The issue is confirmed as a bug. label Jun 28, 2023
@AilinKid
Copy link
Contributor Author

/assign @AilinKid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/minor type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants