fdb-record-layer icon indicating copy to clipboard operation
fdb-record-layer copied to clipboard

Support planning logical group by expression

Open hatyo opened this issue 2 years ago • 0 comments

The physical layer supports group by expression via streaming aggregates. However we miss planning logical group by expressions. To do this, we could introduce a logical group by expression and add some rules to transform it into the physical operator.

In the first version, the logical group by expression will sit on top of select expression and have a sorting requirement of the grouping column(s) that is pushed down to underlying operators forcing the planner to choose an access path that is compatibly-sorted with the grouping column(s). This means that group by expressions can work only when we have e.g. a value index that is compatibly-sorted. Then we could add another rule that transforms the logical group by expression into a streaming aggregation physical operator which will effectively stream the underlying access path and calculate the groups according to the aggregation function(s).

hatyo avatar Jul 18 '22 09:07 hatyo