andygrove opened a new issue, #26300:
URL: https://github.com/apache/datafusion/issues/26300

   ### Is your feature request related to a problem or challenge?
   
   [`DefaultPhysicalPlanner::map_logical_node_to_physical` 
(physical_planner.rs#L593-L1978)](https://github.com/apache/datafusion/blob/0d79252f61bd8777990b2749c216ffd07079c30d/datafusion/core/src/physical_planner.rs#L593-L1978)
 is a single 1,203-line match over `LogicalPlan`, with cognitive complexity 202 
and cyclomatic complexity 122. `physical_planner.rs` has had 80 commits in the 
last 12 months, so concurrent planner work regularly conflicts in this one 
function.
   
   The match over variants is natural, but many arms carry large inline bodies:
   
   - `Join` (about L1372-L1844, ~470 lines, selecting between hash, sort-merge, 
nested-loop and cross joins)
   - `Aggregate` (about L1010-L1197)
   - `Copy` and the five `Dml` arms (about L693-L932)
   - `Window`
   
   Some arms already delegate to helpers (e.g. `Projection`, `Explain`, 
`Analyze`), so the pattern is established.
   
   ### Describe the solution you'd like
   
   Keep the top-level match as a one-line-per-arm dispatcher and move each 
large arm into a private method on `DefaultPhysicalPlanner`: `plan_join` 
(further split by join algorithm), `plan_aggregate`, `plan_window`, 
`plan_copy`, `plan_dml` (one method for the five Dml arms), and so on. Do it 
incrementally, one arm per PR, starting with Join and Aggregate. Optionally 
move them into submodules (`physical_planner/join.rs`, `aggregate.rs`, 
`dml.rs`).
   
   ### Describe alternatives you've considered
   
   Leave it as is, at the cost of continued merge conflicts and harder review 
of planner changes.
   
   ### Additional context
   
   Line references are pinned to commit 0d79252f61bd.
   


-- 
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]

Reply via email to