<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ydb/yql/essentials/core/yql_sqlselect.cpp, branch main</title>
<subtitle>Mirror of YDB github repos</subtitle>
<id>https://code.mastervirt.ru/ydb/atom?h=main</id>
<link rel='self' href='https://code.mastervirt.ru/ydb/atom?h=main'/>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/'/>
<updated>2026-04-28T11:53:09Z</updated>
<entry>
<title>YQL-21046: Support window functions for YqlSelect</title>
<updated>2026-04-28T11:53:09Z</updated>
<author>
<name>vitya-smirnov</name>
<email>vitya-smirnov@yandex-team.com</email>
</author>
<published>2026-04-28T11:05:28Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=ce09b36bc19e2bdb51861a2afc4d7b2a2af5d01f'/>
<id>urn:sha1:ce09b36bc19e2bdb51861a2afc4d7b2a2af5d01f</id>
<content type='text'>
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
</content>
</entry>
</feed>
