[fix](nereids) Ignore lambda-local slots in aggregate validation - #67742
Open
morrySnow wants to merge 1 commit into
Open
[fix](nereids) Ignore lambda-local slots in aggregate validation#67742morrySnow wants to merge 1 commit into
morrySnow wants to merge 1 commit into
Conversation
Problem: HAVING expressions that apply array or map lambda functions to aggregate results were rejected because lambda-local parameters were treated as ungrouped input columns. Fix: Skip ArrayItemSlot while resolving missing aggregate outputs. These slots are bound inside their lambda and are not inputs from the aggregate child, while ordinary SlotReference validation remains unchanged. Tests: - add analyzer coverage for map and array lambda parameters in HAVING - verify a real ungrouped input column is still rejected - add execution-level regression coverage for both lambda forms Issue Number: None
morrySnow
requested review from
924060929,
englefly and
starocean999
as code owners
September 9, 2026 11:35
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
Author
|
run buildall |
Contributor
FE UT Coverage ReportIncrement line coverage |
Contributor
TPC-H: Total hot run time: 16853 ms |
Contributor
TPC-DS: Total hot run time: 81929 ms |
Contributor
ClickBench: Total hot run time: 14.73 s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Valid HAVING predicates were rejected when a lambda function consumed an
aggregate result. Both map and array forms failed because the analyzer treated
the lambda's local parameters as ungrouped table columns.
Root cause
Lambda parameters are represented by
ArrayItemSlot, which extendsSlotReference.FillUpMissingSlots.Resolverrecursively visits HAVINGexpressions and applied normal GROUP BY validation to every
SlotReference,including these lambda-local slots. They are bound by their
ArrayItemReferenceand are not inputs from the aggregate child; the generalexpression input-slot collector already excludes them for the same reason.
Reproduction
The map query reported an internal map-entry parameter as ungrouped, and the
array query reported
xas ungrouped. Both should return(1, 2).Fix
Skip
ArrayItemSlotat the missing-slot resolver entry point. The lambdabinder owns these local slots, so no aggregate output or GROUP BY validation
is needed for them. Ordinary
SlotReferencehandling is unchanged, and areal ungrouped input column inside the surrounding expression is still
rejected.
Tests
rejected.
invalid-column boundary.
(1, 2)for both valid queries and preservedthe expected GROUP BY error for
ungrouped_col.Issue Number: None