jayzhan211 commented on code in PR #27648:
URL: https://github.com/apache/datafusion/pull/27648#discussion_r4709116728


##########
datafusion/core/src/physical_planner.rs:
##########
@@ -3518,13 +3539,42 @@ impl DefaultPhysicalPlanner {
 
         let mut new_plan = Arc::clone(&plan);
         let optimizer_context = SessionOptimizerContext::new(session_state);
+        let enforcement = EnsureRequirements::new();
+        // Whether the requirements held after enforcement ran. Once they 
have, a rule

Review Comment:
   Agreed. Fixing the two rules that break requirements after 
`EnsureRequirements` looks like a better choice than this PR. On the 
sqllogictest suite, when I move each rule that runs before `EnsureRequirements` 
(other than `OutputRequirements`) to after it, only `JoinSelection` and 
`WindowTopN` break a requirement. With each of them fixed to keep the 
requirements it finds satisfied (#27771, #27772):
   
   - `JoinSelection` after `EnsureRequirements`: 293 planning errors → 1
   - `WindowTopN` after `EnsureRequirements`: 1 → 0, and a query that put the 
NULL row first for `ORDER BY pk` now returns it last
   - no plan change in the default order
   
   Each rule then turns a valid plan into a valid plan, so a broken rule still 
fails planning with its name, and the physical planner needs no repair step 
after each rule, so the lost parallelism @zhuqi-lucas found can't happen.
   
   If you agree, I'll close this PR in favor of those two.
   



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