feat(sql): Support RANK/DENSE_RANK in unified SQL - #5720
Conversation
PR Reviewer Guide 🔍(Review updated until commit 77ae6e0)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to 77ae6e0 Explore these optional code suggestions:
Previous suggestionsSuggestions up to commit 747d1b6
Suggestions up to commit 352ffbd
|
352ffbd to
747d1b6
Compare
|
Persistent review updated to latest commit 747d1b6 |
Both were accepted by the SQL grammar and declared as BuiltinFunctionName constants, but missing from WINDOW_FUNC_MAPPING, so visitWindowFunction rejected them with "Unexpected window function". Register both, extend the ROW_NUMBER bypass of aggregate signature validation since they likewise take no arguments, and lower them to SqlStdOperatorTable.RANK and DENSE_RANK. WINDOW_FUNC_MAPPING is shared, so PPL eventstats/streamstats now resolve these functions as well. Related to opensearch-project#5168 Signed-off-by: Chen Dai <daichen@amazon.com>
747d1b6 to
77ae6e0
Compare
|
Persistent review updated to latest commit 77ae6e0 |
Description
RANK and DENSE_RANK were already accepted by the SQL grammar and declared as BuiltinFunctionName constants, but were missing from WINDOW_FUNC_MAPPING, so visitWindowFunction rejected them with "Unexpected window function".
Register both in the window function mapping, extend the ROW_NUMBER bypass of aggregate signature validation since they likewise take no arguments, and lower them to SqlStdOperatorTable.RANK and DENSE_RANK. Calcite rank operators disallow framing, so the ROWS/RANGE flag is normalized away.
The mapping is shared with PPL, so eventstats/streamstats now resolve these functions instead of erroring. They return rank 1 for every row there, since neither command can express an ORDER BY.
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.