[BugFix] Fix FILTER(WHERE) dropped on aggregates in unified SQL path#5523
Conversation
PR Reviewer Guide 🔍(Review updated until commit 874dff8)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
CalciteAggCallVisitor ignored AggregateFunction.condition, so COUNT(*) FILTER(WHERE age > 30) degraded to COUNT(). Apply the predicate via AggCall.filter() (wrapped in IS TRUE), and retain its input columns in the pre-aggregation trimming projection so they re-resolve. PPL is unaffected (it never sets condition). Signed-off-by: Chen Dai <daichen@amazon.com>
48ba7d9 to
874dff8
Compare
|
Persistent review updated to latest commit 874dff8 |
Description
This PR fixes aggregate
FILTER(WHERE ...)clauses being silently dropped in the unified SQL path, where the predicate was ignored when building the CalciteAggCall. The filter is now applied to the aggregate call and its referenced columns are preserved through the pre-aggregation trimming projection, with no impact on PPL.Related Issues
Part of #5248
Check List
--signoffor-s.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.