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

Revert "Minor: remove unnecessary projection in `single_distinct_to_g… #8176

Merged
merged 2 commits into from
Nov 14, 2023

Conversation

NGA-TRAN
Copy link
Contributor

@NGA-TRAN NGA-TRAN commented Nov 14, 2023

…roup_by` rule (#8061)"

This reverts commit 15d8c9b.

Which issue does this PR close?

Closes #8175
Closes #8178

Rationale for this change

Revert the change as it introduced bugs

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

@github-actions github-actions bot added optimizer Optimizer rules sqllogictest SQL Logic Tests (.slt) labels Nov 14, 2023
@NGA-TRAN
Copy link
Contributor Author

@alamb @haohuaijin

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @NGA-TRAN . Since this is a bug fix for a regression, I plan to merge it asap.

I also added a regression test in in 3466168 to prevent future breakages

@alamb
Copy link
Contributor

alamb commented Nov 14, 2023

Looks like @NGA-TRAN and I both added the test (sorry I didn't see #8178) . Since this one is green let's merge it .

@alamb alamb merged commit abb2ae7 into apache:main Nov 14, 2023
22 checks passed
@alamb
Copy link
Contributor

alamb commented Nov 14, 2023

Thanks again @NGA-TRAN

@haohuaijin
Copy link
Contributor

Thanks for this fix @NGA-TRAN @alamb . I apologize for introducing this bug. The issue arises from mishandling aliases in the group by clause. Consequently, any queries like the following will result in errors in #8061

select a+1 as alias, count(distinct b) from t group by alias

Thanks again @NGA-TRAN @alamb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
optimizer Optimizer rules sqllogictest SQL Logic Tests (.slt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regression: Count distinct with date_part/date_bin does not work
3 participants