risinglight
risinglight copied to clipboard
optimizer: add property `sorted` to plan nodes
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.
Let me have a try! : )
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.
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.