-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Labels
Description
For historical reasons children in LogicalPlan are Arc<LogicalPlan> (so shared, immutable references)
For many optimizer optimizations we need a owned LogicalPlan
This can be achieved via unwrap_arc
However, as pointed out by #10460 (comment) @ClSlaid it is not obvious at first
Today to get a builder from a plan you need to know this pattern:
// the builder accepts LogicalPlan only, so get one via unwrap_arc
let mut builder = LogicalPlanBuilder::from(unwrap_arc(plan));I think it would be great to support this pattern:
// the builder accepts Arc<LogicalPlan> directly
let mut builder = LogicalPlanBuilder::from(plan);And the underlying impl From<Arc<LogicalPlan>> for LogicalPlanBuilder would call unwrap_arc