Resolve SQL unified query gaps for SELECT clauses and window functions#5450
Conversation
PR Reviewer Guide 🔍(Review updated until commit 3211f0b)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to 3211f0b Explore these optional code suggestions:
Previous suggestionsSuggestions up to commit 85838eb
Suggestions up to commit 27041da
Suggestions up to commit 365855e
Suggestions up to commit 563a054
Suggestions up to commit b1c5970
|
7d2d33b to
b1c5970
Compare
|
Persistent review updated to latest commit b1c5970 |
b1c5970 to
563a054
Compare
|
Persistent review updated to latest commit 563a054 |
563a054 to
365855e
Compare
|
Persistent review updated to latest commit 365855e |
365855e to
27041da
Compare
|
Persistent review updated to latest commit 27041da |
27041da to
85838eb
Compare
|
Persistent review updated to latest commit 85838eb |
…alues dual-table in visitor Add visitLimit to support LIMIT/OFFSET clauses. Handle Alias nodes in project list by referencing already-computed aggregate fields instead of re-analyzing. Add visitRelationSubquery for derived tables in FROM clause. Fix visitValues to treat a single empty row as a dual-table (SELECT without FROM). Make bucketNullable lookup null-safe with getOrDefault in visitAggregation. Add integration tests covering LIMIT OFFSET, aggregate with alias, GROUP BY without bucket nullable, SELECT with alias, derived table subquery, and SELECT without FROM clause. Signed-off-by: Chen Dai <daichen@amazon.com>
Add AggregateFunction handling in visitWindowFunction to support aggregate-based window expressions with DISTINCT and ORDER BY keys. Add translateOrderKeys utility for window ORDER BY translation. Register row_number in WINDOW_FUNC_MAPPING and skip aggregate signature validation for it (it has no field/args). Pass distinct flag through makeOver call chain. RANK and DENSE_RANK are deferred to a follow-up alongside the open PPL eventstats/streamstats issue (opensearch-project#5168) which involves the same function registration and a separate ORDER BY semantics question. Register ISNULL as alias for IS_NULL in PPLFuncImpTable. Add integration tests for window functions with ORDER BY, ROW_NUMBER, COUNT DISTINCT OVER, and ISNULL. Signed-off-by: Chen Dai <daichen@amazon.com>
85838eb to
3211f0b
Compare
|
Persistent review updated to latest commit 3211f0b |
CalciteRelNodeVisitor for Limit, Alias, Subquery, and Values
Description
Resolves Category B remaining gaps from the SQL V2 Calcite gap analysis:
SELECT Statements
LIMIT n OFFSET mnow apply correctly (B8/B19)BUCKET_NULLABLEargument is absent (B1/B16)SELECT dept, COUNT(*) AS cnt ... GROUP BY deptcorrectly references computed aggregate fields in projectionSELECT ... FROM (SELECT ...) AS tsubqueries in FROM clauseSELECT 1(dual-table / VALUES) no longer throws exceptionFunctions
SUM(x) OVER (PARTITION BY y ORDER BY z)now translates order keysIS_NULL(B14)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.