Return 4xx instead of 500 for unsupported window functions#5587
Merged
dai-chen merged 1 commit intoJun 25, 2026
Merged
Conversation
Contributor
PR Reviewer Guide 🔍(Review updated until commit bc9bc97)Here are some key observations to aid the review process:
|
fdb42d7 to
5068696
Compare
Contributor
|
Persistent review updated to latest commit 5068696 |
Window functions outside WINDOW_FUNC_MAPPING (e.g. RANK) used to escape the AE route as HTTP 500 because the throw site emitted a raw UnsupportedOperationException, which UnifiedQueryPlanner rethrows unchanged. Switching to CalciteUnsupportedException lets the existing 4xx wrapper added in opensearch-project#5569 normalize it to SemanticCheckException. Repro: SELECT RegionID, COUNT(*) AS cnt, RANK() OVER (ORDER BY COUNT(*) DESC) AS rnk FROM clickbench GROUP BY RegionID LIMIT 5 Signed-off-by: Michael Oviedo <mikeovi@amazon.com>
5068696 to
bc9bc97
Compare
Contributor
|
Persistent review updated to latest commit bc9bc97 |
sandeshkr419
approved these changes
Jun 25, 2026
ahkcs
approved these changes
Jun 25, 2026
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.
Description
Window functions outside
WINDOW_FUNC_MAPPING(e.g.RANK) were escaping the analytics-engine route as HTTP 500. The throw site inCalciteRexNodeVisitor#visitWindowFunctionemitted a rawUnsupportedOperationException, whichUnifiedQueryPlanner.planrethrows unchanged, so it never got reclassified as a client error.Switching the throw to
CalciteUnsupportedExceptionlets the 4xx wrapper from #5569 take over and normalize it toSemanticCheckException.Repro:
Test plan
UnifiedQueryPlannerTest#unsupportedWindowFunctionIsRethrownAsSemanticCheckException: fails onmain, passes with the fixCalcitePPLEventstatsIT#testUnsupportedWindowFunctionsstill greenCheck List
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.