Support PREV/NEXT in PyDough #158
Labels
effort - high
major issue that will require multiple steps or complex design
enhancement
New feature or request
user feature
Adding a new user-facing feature/functionality
Issue #157 is a pre-requisite for this issue since it starts the handling of some of the window aspects and has overlapping logic. The idea is that
PREV
accesses a singular collection corresponding to the previous record of the current collection, and can be used in a similar manner asBACK
. By default it takes in no arguments, but can have the following:n
: for PREV, this is how many records to go back (e.g.PREV(n).x
is equivalent toLAG(x, n)
). The default is 1.NEXT(n)
is equivalent toPREV(-n)
.by
: seeRANKING
(order keys)level
: seeRANKING
(partition keys)The implementation will have components in the unqualified node stages, qualification, QDAG, hybrid nodes, hybrid conversion, relational nodes, and relational conversion, but ideally much of what was done for
RANKING
can be re-used. For this issue, anything other than references to expressions from prev/next can be forbidden (e.g. callingHAS
or accessing subcollections can be left for a followup issue, which should be opened if they are not handled in the original implementation).Example usages:
The text was updated successfully, but these errors were encountered: