[SPARK-51589][SQL] Fix small bug failing to check for aggregate functions in |> SELECT #50352
+141
−3
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.
What changes were proposed in this pull request?
This PR fixes a small bug with
|> SELECT
with aggregate functions without aliases. In such cases, we should be returning an error instructing the user to use|> AGGREGATE
instead, but we do not.This bug only happens when the aggregate function does not have any alias.
For example:
Before this PR, the above query returned a result of 1. After this PR, the above query instead returns an error instructing the user to switch to
|> AGGREGATE
to perform the sum operation instead.Why are the changes needed?
The documented behavior of
|> SELECT
is that the expression list must not contain any aggregate functions, and the user receives an error otherwise.Does this PR introduce any user-facing change?
Yes, see above.
How was this patch tested?
This PR adds golden file based test coverage.
Was this patch authored or co-authored using generative AI tooling?
No.