gabotechs commented on code in PR #18739:
URL: https://github.com/apache/datafusion/pull/18739#discussion_r2536515247
##########
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:
How about just having here something like:
```rust
pub struct OptimizerContext {
session_config: SessionConfig,
}
```
I imagine this struct to be equivalent to `TaskContext` but for optimization
passes rather than execution, and that struct does have the `session_config`
"as-is" as a field:
https://github.com/apache/datafusion/blob/main/datafusion/execution/src/task.rs#L42-L42
And this way, if in the future changes are made to the `SessionConfig`, we
do not need to come back here and update also `OptimizerContext`
--
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]