-
Notifications
You must be signed in to change notification settings - Fork 28.2k
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
[SPARK-48740][SQL] Catch missing window specification error early #47129
Closed
Conversation
This file contains 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
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/AnalysisErrorSuite.scala
Outdated
Show resolved
Hide resolved
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala
Outdated
Show resolved
Hide resolved
HyukjinKwon
changed the title
[SPARK-48740] Catch missing window specification error early
[SPARK-48740][SQL] Catch missing window specification error early
Jun 27, 2024
gengliangwang
approved these changes
Jun 28, 2024
@asl3 please fix the test failures in SQLQueryTestSuite and I will merge this one. |
github-actions
bot
added
STRUCTURED STREAMING
BUILD
DOCS
CORE
INFRA
PYTHON
CONNECT
labels
Jul 1, 2024
asl3
force-pushed
the
improve-window-partition-error
branch
from
July 1, 2024 02:06
79e7b9b
to
58f45b7
Compare
github-actions
bot
removed
STRUCTURED STREAMING
BUILD
DOCS
CORE
INFRA
PYTHON
CONNECT
labels
Jul 1, 2024
sql/core/src/test/resources/sql-tests/analyzer-results/postgreSQL/window_part3.sql.out
Outdated
Show resolved
Hide resolved
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala
Outdated
Show resolved
Hide resolved
gengliangwang
approved these changes
Jul 29, 2024
…ysis/CheckAnalysis.scala
Thanks, merging to master |
fusheng-rd
pushed a commit
to fusheng-rd/spark
that referenced
this pull request
Aug 6, 2024
### What changes were proposed in this pull request? Before, aggregate queries containing a window function without a window specification (e.g. `PARTITION BY`) would return a non-descriptive internal error message: `org.apache.spark.sql.catalyst.analysis.UnresolvedException: [INTERNAL_ERROR] Invalid call to exprId on unresolved object SQLSTATE: XX000` This PR catches the user error early and returns a more accurate description of the issue: `Window specification is not defined in the WINDOW clause for <windowName>. For more information about WINDOW clauses, please refer to '<docroot>/sql-ref-syntax-qry-select-window.html'.` ### Why are the changes needed? This change produces a more descriptive error message for window functions, improving the Spark user experience. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Added unit test in `sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/AnalysisErrorSuite.scala` ### Was this patch authored or co-authored using generative AI tooling? No Closes apache#47129 from asl3/improve-window-partition-error. Lead-authored-by: Amanda Liu <[email protected]> Co-authored-by: Gengliang Wang <[email protected]> Signed-off-by: Gengliang Wang <[email protected]>
attilapiros
pushed a commit
to attilapiros/spark
that referenced
this pull request
Oct 4, 2024
### What changes were proposed in this pull request? Before, aggregate queries containing a window function without a window specification (e.g. `PARTITION BY`) would return a non-descriptive internal error message: `org.apache.spark.sql.catalyst.analysis.UnresolvedException: [INTERNAL_ERROR] Invalid call to exprId on unresolved object SQLSTATE: XX000` This PR catches the user error early and returns a more accurate description of the issue: `Window specification is not defined in the WINDOW clause for <windowName>. For more information about WINDOW clauses, please refer to '<docroot>/sql-ref-syntax-qry-select-window.html'.` ### Why are the changes needed? This change produces a more descriptive error message for window functions, improving the Spark user experience. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Added unit test in `sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/AnalysisErrorSuite.scala` ### Was this patch authored or co-authored using generative AI tooling? No Closes apache#47129 from asl3/improve-window-partition-error. Lead-authored-by: Amanda Liu <[email protected]> Co-authored-by: Gengliang Wang <[email protected]> Signed-off-by: Gengliang Wang <[email protected]>
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.
What changes were proposed in this pull request?
Before, aggregate queries containing a window function without a window specification (e.g.
PARTITION BY
) would return a non-descriptive internal error message:org.apache.spark.sql.catalyst.analysis.UnresolvedException: [INTERNAL_ERROR] Invalid call to exprId on unresolved object SQLSTATE: XX000
This PR catches the user error early and returns a more accurate description of the issue:
Window specification is not defined in the WINDOW clause for <windowName>. For more information about WINDOW clauses, please refer to '<docroot>/sql-ref-syntax-qry-select-window.html'.
Why are the changes needed?
This change produces a more descriptive error message for window functions, improving the Spark user experience.
Does this PR introduce any user-facing change?
No
How was this patch tested?
Added unit test in
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/AnalysisErrorSuite.scala
Was this patch authored or co-authored using generative AI tooling?
No