You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/library-user-guide/upgrading.md
+96Lines changed: 96 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -332,6 +332,102 @@ let config = FileScanConfigBuilder::new(url, source)
332
332
333
333
**Handling projections in `FileSource`:**
334
334
335
+
### `PhysicalOptimizerRule::optimize` deprecated in favor of `optimize_plan`
336
+
337
+
The `PhysicalOptimizerRule` trait has been updated to provide optimizer rules with access to broader session context. A new method `optimize_plan` has been added that accepts an `OptimizerContext` parameter, and the existing `optimize` method has been deprecated.
338
+
339
+
**Who is affected:**
340
+
341
+
- Users who have implemented custom `PhysicalOptimizerRule` implementations
342
+
343
+
**Breaking changes:**
344
+
345
+
1.**New `optimize_plan` method**: This is the preferred method for implementing optimization rules. It provides access to the full `SessionConfig` through `OptimizerContext`, rather than just `ConfigOptions`.
346
+
347
+
2.**`optimize` method deprecated**: The old `optimize` method that takes `&ConfigOptions` is now deprecated and will be removed in DataFusion 58.0.0.
348
+
349
+
**Migration guide:**
350
+
351
+
If you have a custom `PhysicalOptimizerRule` implementation, update it to implement `optimize_plan` instead of `optimize`:
`OptimizerContext` is a new struct that provides context during physical plan optimization, similar to how `TaskContext` provides context during execution. It wraps `SessionConfig`, giving optimizer rules access to:
425
+
426
+
- Configuration options via `context.session_config().options()`
427
+
- Session extensions via `context.session_config().extensions()`
428
+
429
+
This enables optimizer rules to access custom extensions registered with the session, which was not possible with the old `&ConfigOptions` parameter.
0 commit comments