risinglight icon indicating copy to clipboard operation
risinglight copied to clipboard

optimizer: add property `sorted` to plan nodes

Open skyzh opened this issue 2 years ago • 3 comments

We can have a struct like PlanBase, which is included in all optimizer plan nodes. Then, we can have sorted inside, along with the sort keys (e.g. struct PlanBase { sorted: Vec<usize> }), and add code to infer the property across plan nodes.

skyzh avatar Apr 03 '22 07:04 skyzh

Let me have a try! : )

shmiwy avatar May 06 '22 16:05 shmiwy

I think we can start with https://github.com/risinglightdb/risinglight/issues/645 first, and make range filter scan more powerful and useful later with sorted property induction. 🤪 We can postpone this issue a little bit.

skyzh avatar May 07 '22 02:05 skyzh

In the new planner, this can be implemented as an analysis. The associated data could be Vec<(key: Id, asc_or_desc: bool)>. After this is done, we could have sort-merge-join and sort-group-agg.

wangrunji0408 avatar Jan 08 '23 04:01 wangrunji0408