Make OptimizerRule Consuming
- Dominant language
- Rust
- Stars
- 9.3k
- Forks
- 2.4k
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 344
Description
**Is your feature request related to a problem or challenge? Please describe what you are trying to do.**
The current interface for `OptimizerRule` takes `&LogicalPlan`, effectively forcing rules to clone their input.
**Describe the solution you'd like**
#4208 added a try_optimise method to try to reduce this, but I think it would make for a cleaner interface if the method was simply.
```
fn apply(
&self,
plan: LogicalPlan,
optimizer_config: &mut OptimizerConfig,
) -> Result {
Ok(self.try_optimize(&plan, optimizer_config)?.unwrap_or(plan))
}
```
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
#4208
FYI @andygrove @alamb @jackwener
Contributor guide
Research direction
Start at the OptimizerRule interface and trace the try_optimise/try_optimize method introduced by #4208, including its rule implementations and callers. The change is complete when apply consumes LogicalPlan consistently, avoids forced cloning, and the existing optimizer checks pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100