Add `ApplyOrder::Recursive` to replace `None: Option<ApplyOrder>` and remove nested pattern matching.
- Dominant language
- Rust
- Stars
- 9.3k
- Forks
- 2.4k
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 344
Description
Currently, we use `None` to represent an optimizing rule to be recursively applied to its children.
And we use `Some(TopDown)` and `Some(BottomUp)` to represent a rule can be directly applied to the child node.
The `None` usage can be directly replaced by introducing a new product type `ApplyOrder::Recursive`.
This can
- remove the usage of nested pattern matching,
- better comment the code ,
- and help the rust compiler to better optimize the code.
This is a follow-up of #4618.
**Describe the solution you'd like**
```
pub enum ApplyOrder {
/// ...
TopDown,
/// ...
BottomUp,
/// ...
Recursive,
}
```
**Describe alternatives you've considered**
We could not do this.
**Additional context**
Add any other context or screenshots about the feature request here.
Contributor guide
Research direction
Locate the ApplyOrder definition and all uses of None: Option in the optimizer code. Read the existing TopDown and BottomUp handling, then update the representation and matching so Recursive replaces None and nested pattern matching is removed. Done means the affected code uses ApplyOrder::Recursive consistently and the relevant Rust tests pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- data-engineering
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100