Skip to content

refactor(physical-plan): simplify ExecutionPlan children-replacement API #23441

Description

@zhuqi-lucas

Follow-up to #23332

Per @alamb's review, landing PR #23332 leaves the ExecutionPlan trait with two methods that each build a new plan from new children:

  • fn with_new_children(self: Arc<Self>, children) -> Result<...> — always recomputes PlanProperties.
  • fn with_new_children_and_same_properties(self: Arc<Self>, children) -> Result<...> — reuses PlanProperties; default falls back to with_new_children.

For someone implementing ExecutionPlan, seeing both is confusing ("which one do I override, and when?"). Long-term the trait should expose a single canonical method.

Proposal

  1. Introduce a canonical entry point, e.g. replace_children(self: Arc<Self>, children, hint: ChildrenPropertiesHint) -> Result<Arc<dyn ExecutionPlan>>, where the hint encodes "same properties, reuse cache" vs "recompute".
  2. Deprecate both with_new_children and with_new_children_and_same_properties with clear migration notes pointing at replace_children.
  3. Migrate the ~30 in-tree ExecutionPlan impls and all direct callers to the new method.
  4. After a couple of releases, drop the deprecated methods, leaving the trait with a single canonical children-replacement primitive.

The with_new_children_if_necessary helper stays the caller-facing API and internally routes to replace_children with the appropriate hint.

Why not fold this into #23332

  • The mechanical migration touches ~30 files; keeping it as a separate PR lets the semantic change (fast-path skip) land first and be reviewed on its own.
  • The API rename is a naming discussion worth its own review thread.

Related

  • PR #23332 — semantic change this issue builds on.
  • Umbrella #22555with_new_children_if_necessary consolidation.

cc @alamb

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions