Skip to content

[multistage] Add Support for Multi-Group Queries for Window Functions #15985

Open
@ankitsultana

Description

@ankitsultana

Queries with multiple partition-by clauses are not supported yet. Example:

SELECT
  ROW_NUMBER() OVER (
        PARTITION BY uuid,
        path,
        ORDER BY
          inserted_at DESC
      ) AS rn,
      RANK() OVER (
        PARTITION BY uuid
        ORDER BY
          inserted_at DESC
      ) AS rk
FROM tbl

The query above fails with the following error which comes from the window exchange node insert rule.

QueryPlanningError: Error optimizing query: Currently only 1 window group is supported, query has 2 groups

One way to tackle such a scenario is to break a Window operator into consecutive operators that run one after another and compute the different window functions. (Presto also does this)

Link:

String.format("Currently only 1 window group is supported, query has %d groups", numGroups));

cc: @somandal

Metadata

Metadata

Assignees

Labels

multi-stageRelated to the multi-stage query enginewindow-functionsRelated to SQL window functions on the multi-stage query engine

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions