[BugFix] Preserve aggregate aliases for unified query SQL#5509
Conversation
PR Reviewer Guide 🔍(Review updated until commit 9a12430)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to 9a12430 Explore these optional code suggestions:
Previous suggestionsSuggestions up to commit ef61b83
Suggestions up to commit cb5a0de
Suggestions up to commit 04a82d3
|
04a82d3 to
cb5a0de
Compare
|
Persistent review updated to latest commit cb5a0de |
cb5a0de to
ef61b83
Compare
SELECT col, COUNT(*) AS cnt only renames a column without changing the set or order, so RelBuilder.project (force=false) skips emitting the LogicalProject and the alias is dropped. Force the projection when an AS renames a field; the PPL path is unaffected since it never produces an AS RexCall through visitProject. Signed-off-by: Chen Dai <daichen@amazon.com>
|
Persistent review updated to latest commit ef61b83 |
ef61b83 to
9a12430
Compare
|
Persistent review updated to latest commit 9a12430 |
Description
This PR fixes SQL aggregate aliases being lost in the unified query SQL path — e.g.
SELECT city, COUNT(*) AS cnt FROM t GROUP BY cityreturned the column asCOUNT(*)instead ofcnt.RelBuilder.project(defaultforce=false) treats it as a no-op and skips emitting theLogicalProject(this minimizes the plan tree, since names of intermediate projections don't matter). We now force the SELECT projection to materialize when it renames a field, so the alias survives in the output schema.ASRexCall through this path (rename/eval/fields/statsbuild output names differently), so the change never triggers for 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.