summaryrefslogtreecommitdiffstats
path: root/yql/essentials/sql/v1/select_yql_window.cpp
Commit message (Collapse)AuthorAgeFilesLines
* YQL-21046: Support window functions for YqlSelectvitya-smirnov2026-04-281-0/+59
This patch adds support for `RowNumber`, `CumeDist`, `NTile`, `Rank`, `DenseRank`, `PercentRank`, `Lead`, `Lag`, `FirstValue`, `LastValue` and `NthValue`. It gives +3 TPC-DS queries and +5 TPC-DS bugs unlocked. The callable `YqlWin` was introduces, having the following form: ```yqls (YqlWin 'function_name 'window_name '() # options (Void) # type slot ...) # args ``` During the callable type annotation and expansion the same code for implementation functions substitution is used and shared even with a pgSQL. There was an issue with a `listType` for `YqlAgg`, `YqlAggWin` and `YqlWin`, because it was built incorrectly by referencing an atom "row" instead of _that_ argument row. It is fixed with a new "type slot". Now it has 3 states: `(Void)`, which is set by translator just as a stub, `row` that is set by `YqlSetItemWrapper` during the `RebuildLambdaColumns`, so then on the `YqlWin` type annotation it can take this `row` and wrap it to the `listType`, pass to the function and call for a repetition, so in a next stage the `resultType` will be ready. commit_hash:256fc2cb359714a646a308359b340b1715919f5d