asolimando commented on code in PR #26094:
URL: https://github.com/apache/datafusion/pull/26094#discussion_r4220514015


##########
datafusion/core/src/physical_planner.rs:
##########
@@ -3123,9 +3138,7 @@ impl DefaultPhysicalPlanner {
         InvariantChecker(InvariantLevel::Always).check(&plan)?;
 
         let mut new_plan = Arc::clone(&plan);
-        let optimizer_context = SessionOptimizerContext {
-            session: session_state,
-        };
+        let optimizer_context = SessionOptimizerContext::new(session_state);

Review Comment:
   Agreed, it is an invariant the design now relies on much more. Added a 
paragraph in 
https://github.com/apache/datafusion/pull/26094/commits/f7587af72580025d7ca6442b204f675f6d8c17af
 to the `StatisticsContext` docs: a plan node must not change its statistics in 
place while a context holds it, otherwise the cache returns stale values; 
optimizer rules satisfy this because they replace nodes instead of changing 
them.



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