gabotechs commented on code in PR #18739:
URL: https://github.com/apache/datafusion/pull/18739#discussion_r2536977806


##########
datafusion/physical-optimizer/src/optimizer.rs:
##########
@@ -38,9 +38,49 @@ use crate::update_aggr_exprs::OptimizeAggregateOrder;
 
 use crate::limit_pushdown_past_window::LimitPushPastWindows;
 use datafusion_common::config::ConfigOptions;
-use datafusion_common::Result;
+use datafusion_common::{internal_err, Result};
+use datafusion_execution::config::{Extensions, SessionConfig};
 use datafusion_physical_plan::ExecutionPlan;
 
+/// Context for optimizing physical plans.
+///
+/// This context provides access to session configuration and optimizer 
extensions.
+///
+/// Similar to [`TaskContext`] which provides context during execution,
+/// `OptimizerContext` provides context during optimization.
+///
+/// [`TaskContext`]: 
https://docs.rs/datafusion/latest/datafusion/execution/struct.TaskContext.html
+#[derive(Debug, Clone)]
+pub struct OptimizerContext {
+    /// Config options
+    config_options: Arc<ConfigOptions>,
+    /// Extensions
+    extensions: Arc<Extensions>,

Review Comment:
   I'd deliberately copy what `TaskContext` is doing in order to keep both 
structure's as consistent as possible, that way the user experience of 
accessing an `OptimizerContext` is as close as possible as accessing 
`TaskContext`.
   
   There, the field is private, but it can be accessed through a method:
   
   
https://github.com/apache/datafusion/blob/main/datafusion/execution/src/task.rs#L96-L100



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