markj-db opened a new pull request, #56216: URL: https://github.com/apache/spark/pull/56216
### What changes were proposed in this pull request? Extract the operator-ID-assignment phase of `ExplainUtils.processPlan` into a private `assignOperatorIds(plan, idMap)` helper. `processPlan` now initializes the idMap, delegates all ID assignment to `assignOperatorIds`, then performs the text-output pass over the returned subqueries and optimized-out exchanges. ### Why are the changes needed? `processPlan` conflated two independent sequential phases in one ~40-line body: 1. **ID assignment** — traversing the plan tree, subqueries, and adaptively-optimized-out exchanges (SPARK-42753) to populate an `IdentityHashMap` with monotonically-increasing operator IDs. 2. **Text output** — calling `processPlanSkippingSubqueries` on each discovered subtree to format the verbose explain string. These phases are sequential and independent: the text-output pass only begins after ID assignment is fully complete. Extracting phase 1 into `assignOperatorIds` shortens `processPlan` to its output logic and makes the boundary between the two phases explicit. No behavior change. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Added `ExplainUtilsSuite` covering: - Operator IDs assigned to all visible plan nodes are unique - `processPlan` sets `CODEGEN_ID_TAG` on nodes inside `WholeStageCodegenExec` - Thread-local `localIdMap` is restored to its prior value after `processPlan` returns - Subquery section is emitted in the explain output when subqueries are present ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude (Anthropic) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
