You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[SPARK-54136][SQL] Extract plan merging logic from MergeScalarSubqueries to PlanMerger
### What changes were proposed in this pull request?
This PR extracts the plan merging logic from `MergeScalarSubqueries` to `PlanMerger` so as to other rules can reuse it.
While the plan merging logic is extracted without modification to `PlanMerger`, `MergeScalarSubqueries` required a significant adjustment. This is because [SPARK-40618](https://issues.apache.org/jira/browse/SPARK-40618) / #38093 added subquery reference tracking so as to avoid trying to merge a subquery to any of its nested subqueries. This kind of reference trancking doesn't work well with a general `PlanMerger` so this PR modifies `MergeScalarSubqueries` to use a separate `PlanMerger`s by each subquery level.
### Why are the changes needed?
To be able to reuse plan merging logic.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
Existing UTs.
### Was this patch authored or co-authored using generative AI tooling?
Yes, Claude gave me suggestions to improve documentation.
Closes#52835 from peter-toth/SPARK-54136-extract-plan-merging-logic.
Authored-by: Peter Toth <[email protected]>
Signed-off-by: Peter Toth <[email protected]>
0 commit comments