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

Fix bug in CombineApproxPercentileFunctions with duplicate aggregation expressions #18889

Merged

Conversation

feilong-liu
Copy link
Contributor

@feilong-liu feilong-liu commented Dec 30, 2022

The current implementation assumes that there are no duplicate aggregation expressions, which does not hold in some cases. To solve this problem, I need to either 1) fix the code to take care of the duplicates or 2) filter these aggregations which have duplicates. Since approach 1 will complicate the code and it's not a common case, I decided to take approach 2 to filter out these aggregations to fix the bug.

Test plan - (Please fill in how you tested your changes)

Add unit tests.

== RELEASE NOTES ==

General Changes
* Fix bug in CombineApproxPercentileFunctions optimization. 
   It fix the bug where the CombineApproxPercentileFunctions optimization rule fails when there are duplicate aggregation expressions to be optimized.

@feilong-liu feilong-liu requested a review from a team as a code owner December 30, 2022 05:51
@feilong-liu feilong-liu force-pushed the fix_approx_percentile_optimization branch from 33646a7 to d69c56d Compare December 30, 2022 05:52
@feilong-liu feilong-liu requested a review from kaikalur December 30, 2022 05:54
The current implementation assumes that there are no duplicate aggregation
expressions, which does not hold in some cases. In this PR, I filter
out these aggregations to fix the bug.
@feilong-liu feilong-liu force-pushed the fix_approx_percentile_optimization branch from d69c56d to d07f88d Compare December 30, 2022 06:04
@rschlussel rschlussel merged commit e349c4a into prestodb:master Jan 3, 2023
@kaikalur
Copy link
Contributor

kaikalur commented Jan 3, 2023

On second thoughts, talking to Feilong offline, I feel we should not have special cases like this, instead fix up the optimization to project out original expressions (multiple times if needed).

@rschlussel
Copy link
Contributor

Sounds good. let's do a follow up fix, but in the meantime at least the queries will stop failing.

@wanglinsong wanglinsong mentioned this pull request Jan 12, 2023
30 tasks
@feilong-liu feilong-liu deleted the fix_approx_percentile_optimization branch January 24, 2023 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants