Repository navigation
Commit c2f8e47
refactor: move planning APIs to session crate (apache#23842)
## Which issue does this PR close?
- Addresses a portion of
apache#23678
- Follow on to apache#23703
## Rationale for this change
This PR unlocks using a query planner across the FFI boundary.
## What changes are included in this PR?
Moves these traits to the `datafusion-session` crate:
- `QueryPlanner`
- `PhysicalPlanner`
- `ExtensionPlanner`
- `PhysicalOptimizerRule`
- `PhysicalOptimizerContext`
Additionally changed the method signatures from taking `&SessionState`
to `&dyn Session`.
Adds these methods on `Session` trait:
- `fn query_planner(&self) -> Arc<dyn QueryPlanner + Send + Sync>`
- `fn optimize(&self, plan: &LogicalPlan) -> Result<LogicalPlan>`
- `fn physical_optimizers(&self) -> &[Arc<dyn PhysicalOptimizerRule +
Send + Sync>]`
- `fn statistics_registry(&self) -> Option<&StatisticsRegistry>`
## Are these changes tested?
Unit tests are added for the new methods.
## Are there any user-facing changes?
Yes, users must implement new methods for `query_planner` for their
custom `Session`. This is not expected to impact many users, since it is
most common to use the existing `SessionState`.
---------
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>1 parent 34f922d commit c2f8e47
15 files changed
Lines changed: 698 additions & 276 deletions
File tree
- datafusion-examples/examples
- dataframe
- relation_planner
- datafusion
- core
- src
- execution
- context
- tests/user_defined
- ffi/src/session
- physical-optimizer
- src
- session/src
- docs/source/library-user-guide/upgrading
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
146 | 147 | | |
147 | 148 | | |
148 | 149 | | |
149 | | - | |
| 150 | + | |
150 | 151 | | |
151 | 152 | | |
152 | 153 | | |
| |||
200 | 201 | | |
201 | 202 | | |
202 | 203 | | |
203 | | - | |
| 204 | + | |
204 | 205 | | |
205 | 206 | | |
206 | 207 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| 105 | + | |
105 | 106 | | |
106 | | - | |
107 | | - | |
| 107 | + | |
| 108 | + | |
108 | 109 | | |
109 | 110 | | |
110 | 111 | | |
| |||
565 | 566 | | |
566 | 567 | | |
567 | 568 | | |
568 | | - | |
| 569 | + | |
569 | 570 | | |
570 | 571 | | |
571 | 572 | | |
| |||
587 | 588 | | |
588 | 589 | | |
589 | 590 | | |
590 | | - | |
| 591 | + | |
591 | 592 | | |
592 | 593 | | |
593 | 594 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | 20 | | |
22 | 21 | | |
23 | 22 | | |
| |||
2181 | 2180 | | |
2182 | 2181 | | |
2183 | 2182 | | |
| 2183 | + | |
2184 | 2184 | | |
2185 | | - | |
2186 | | - | |
2187 | | - | |
2188 | | - | |
2189 | | - | |
2190 | | - | |
2191 | | - | |
2192 | | - | |
2193 | | - | |
| 2185 | + | |
2194 | 2186 | | |
2195 | 2187 | | |
2196 | 2188 | | |
| |||
2390 | 2382 | | |
2391 | 2383 | | |
2392 | 2384 | | |
| 2385 | + | |
2393 | 2386 | | |
2394 | 2387 | | |
2395 | 2388 | | |
| |||
2836 | 2829 | | |
2837 | 2830 | | |
2838 | 2831 | | |
2839 | | - | |
| 2832 | + | |
2840 | 2833 | | |
2841 | 2834 | | |
2842 | 2835 | | |
| |||
2845 | 2838 | | |
2846 | 2839 | | |
2847 | 2840 | | |
2848 | | - | |
| 2841 | + | |
2849 | 2842 | | |
2850 | 2843 | | |
2851 | 2844 | | |
| |||
2860 | 2853 | | |
2861 | 2854 | | |
2862 | 2855 | | |
2863 | | - | |
| 2856 | + | |
2864 | 2857 | | |
2865 | 2858 | | |
2866 | 2859 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
77 | | - | |
78 | 76 | | |
79 | 77 | | |
80 | 78 | | |
81 | | - | |
| 79 | + | |
82 | 80 | | |
83 | 81 | | |
84 | 82 | | |
| |||
274 | 272 | | |
275 | 273 | | |
276 | 274 | | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
277 | 294 | | |
278 | 295 | | |
279 | 296 | | |
| |||
2322 | 2339 | | |
2323 | 2340 | | |
2324 | 2341 | | |
2325 | | - | |
| 2342 | + | |
2326 | 2343 | | |
2327 | 2344 | | |
2328 | 2345 | | |
| |||
0 commit comments