2010YOUY01 commented on PR #27648:
URL: https://github.com/apache/datafusion/pull/27648#issuecomment-7093788628

   Thank you for working on this. I got a question:
   
   > Every physical optimizer rule after `EnsureRequirements`, including rules 
a project appends to the default list, must keep the plan's order and 
distribution requirements, or planning fails with a `SanityCheckPlan` error. So 
a rule only works where the rules before it left a plan it handles. Running the 
sqllogictest suite with `JoinSelection` moved after `EnsureRequirements` (with 
a local harness, not part of this PR), 293 records fail with that error on main 
at 
[c5361f0](https://github.com/apache/datafusion/commit/c5361f0da2011d57cea7d03074c4c94bec35ac3d);
 with this PR, 0.
   
   Why are we moving `JoinSelection` after `EnsureRequirements`?
   
   I don't think we need to enforce a rule that all optimizations must run 
after `EnsureRequirements`. Instead, the invariant should be:
   - A rule should be placed after `EnsureRequriements` if it have to, since 
this placement make the impl harder (need to recognize RepartitionExec)
   - any rule running after `EnsureRequirements` must preserve the established 
ordering and distribution requirements.
   
   So the question is: what additional requirements motivate moving 
`JoinSelection` after `EnsureRequirements`? I suspect this change is unlikely 
to make the implementation simpler.


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