somandal opened a new pull request, #10449: URL: https://github.com/apache/pinot/pull/10449
This PR introduces the multi-stage runtime changes to support Phase 1 of Window Functions, specifically targeting queries of the type `OVER(ORDER BY)` and `OVER(PARTITION BY key1 ORDER BY key2)`. Runtime support has been added for the following classes of window queries: - `OVER(ORDER BY)` - single and multiple `OVER(ORDER BY)` in the same query - `OVER(PARTITION BY key1 ORDER BY key2)` - single and multiple `OVER(PARTITION BY key1 ORDER BY key2)` using the same `PARTITION BY` key and `ORDER BY` key across all `OVER()s` in the same query The window functions supported as part of Phase 1 are: SUM, AVG, MIN, MAX, COUNT, BOOL_OR, and BOOL_AND. PostgreSQL supports many aggregation functions inside window functions as mentioned in their [documentation](https://www.postgresql.org/docs/current/functions-window.html): > In addition to these functions, any built-in or user-defined ordinary aggregate (i.e., not ordered-set or hypothetical-set aggregates) can be used as a window function; see Section 9.21 for a list of the built-in aggregates. Aggregate functions act as window functions only when an OVER clause follows the call; otherwise they act as plain aggregates and return a single row for the entire set. Design document: https://docs.google.com/document/d/13CmFm4djI09JKF_Xty5acoXxJoxC9CLXAsmikgzgtIs/edit?usp=sharing Window functions Issue: https://github.com/apache/pinot/issues/7213 Window Function Planner PR: https://github.com/apache/pinot/pull/10228 Window Functions Runtime PR for empty OVER() and OVER(PARTITION BY): https://github.com/apache/pinot/pull/10286 Adding ordering as a part of the SortExchange: https://github.com/apache/pinot/pull/10408 This PR does not include support for: - Custom frames - Other window functions related to rank and values - Multiple window groups (basically multiple OVER clauses with different PARTITION BY, ORDER BY and/or FRAME specifications, if these specifications are the same they get grouped into a single window group) The above will be part of future changes for window function support **Note:** One issue was found while working on this PR related to Apache Calcite parsing. Details can be found in [this section of the design document](https://docs.google.com/document/d/13CmFm4djI09JKF_Xty5acoXxJoxC9CLXAsmikgzgtIs/edit#heading=h.s6az8ttq3x5f). Look for heading **"Calcite Parser Exception on ORDER BY with > 1 column using default frame"** cc @siddharthteotia @walterddr @vvivekiyer @ankitsultana -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
