Commit dd8760d
chore: remove as_any from ExecutionPlan (#21263)
## Which issue does this PR close?
This is a follow on to #20812 and #21209 but treats `ExecutionPlan`.
## Rationale for this change
This PR reduces the amount of boilerplate code that users need to write
for execution plans.
## What changes are included in this PR?
Now that we have [trait
upcasting](https://blog.rust-lang.org/2025/04/03/Rust-1.86.0/) since
rust 1.86, we no longer need every implementation of these functions to
have the as_any function that returns &self. This PR makes Any an
supertrait and makes the appropriate casts when necessary.
I have also implemented functions `is` and `downcast_ref` on the trait
object for ExecutionPlan and applied this same pattern to the udf, udaf,
and udwf implementations. This allows for a clean downcasting and type
checking.
## Are these changes tested?
Existing unit tests.
## Are there any user-facing changes?
Yes, the users simply need to remove the `as_any` function. The upgrade
guide is updated.
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent a89b527 commit dd8760d
106 files changed
Lines changed: 403 additions & 773 deletions
File tree
- datafusion-examples/examples
- custom_data_source
- data_io
- execution_monitoring
- proto
- relation_planner
- datafusion
- catalog/src/memory
- core
- src
- datasource/listing
- test_util
- tests
- custom_sources_cases
- fuzz_cases
- memory_limit
- parquet
- physical_optimizer
- sql
- user_defined
- datasource/src
- expr/src
- ffi
- src
- proto
- tests
- udaf
- udf
- udwf
- tests
- functions/src
- core
- math
- physical-expr/src
- physical-optimizer/src
- enforce_sorting
- physical-plan/src
- aggregates
- joins
- hash_join
- piecewise_merge_join
- sort_merge_join
- repartition
- sorts
- test
- windows
- proto
- src/physical_plan
- tests/cases
- substrait/src/physical_plan
- docs/source/library-user-guide
- upgrading
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
317 | 317 | | |
318 | 318 | | |
319 | 319 | | |
320 | | - | |
| 320 | + | |
321 | 321 | | |
322 | 322 | | |
323 | 323 | | |
| |||
481 | 481 | | |
482 | 482 | | |
483 | 483 | | |
484 | | - | |
| 484 | + | |
485 | 485 | | |
486 | 486 | | |
487 | 487 | | |
| |||
497 | 497 | | |
498 | 498 | | |
499 | 499 | | |
500 | | - | |
| 500 | + | |
501 | 501 | | |
502 | 502 | | |
503 | 503 | | |
| |||
Lines changed: 0 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | 238 | | |
243 | 239 | | |
244 | 240 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
| 107 | + | |
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| |||
Lines changed: 0 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
47 | 46 | | |
48 | 47 | | |
49 | 48 | | |
| |||
226 | 225 | | |
227 | 226 | | |
228 | 227 | | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | 228 | | |
234 | 229 | | |
235 | 230 | | |
| |||
Lines changed: 2 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | 35 | | |
37 | 36 | | |
38 | 37 | | |
| |||
103 | 102 | | |
104 | 103 | | |
105 | 104 | | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | 105 | | |
111 | 106 | | |
112 | 107 | | |
| |||
161 | 156 | | |
162 | 157 | | |
163 | 158 | | |
164 | | - | |
| 159 | + | |
165 | 160 | | |
166 | 161 | | |
167 | 162 | | |
| |||
188 | 183 | | |
189 | 184 | | |
190 | 185 | | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | 186 | | |
196 | 187 | | |
197 | 188 | | |
| |||
244 | 235 | | |
245 | 236 | | |
246 | 237 | | |
247 | | - | |
| 238 | + | |
248 | 239 | | |
249 | 240 | | |
250 | 241 | | |
| |||
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
127 | | - | |
128 | | - | |
| 127 | + | |
129 | 128 | | |
130 | 129 | | |
131 | 130 | | |
| |||
Lines changed: 0 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
84 | 83 | | |
85 | 84 | | |
86 | 85 | | |
| |||
682 | 681 | | |
683 | 682 | | |
684 | 683 | | |
685 | | - | |
686 | | - | |
687 | | - | |
688 | | - | |
689 | 684 | | |
690 | 685 | | |
691 | 686 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
594 | 594 | | |
595 | 595 | | |
596 | 596 | | |
597 | | - | |
598 | | - | |
599 | | - | |
600 | | - | |
601 | 597 | | |
602 | 598 | | |
603 | 599 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| 110 | + | |
110 | 111 | | |
111 | 112 | | |
112 | 113 | | |
| |||
404 | 405 | | |
405 | 406 | | |
406 | 407 | | |
407 | | - | |
| 408 | + | |
408 | 409 | | |
409 | 410 | | |
410 | 411 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3632 | 3632 | | |
3633 | 3633 | | |
3634 | 3634 | | |
3635 | | - | |
3636 | 3635 | | |
3637 | 3636 | | |
3638 | 3637 | | |
| |||
3660 | 3659 | | |
3661 | 3660 | | |
3662 | 3661 | | |
3663 | | - | |
3664 | 3662 | | |
3665 | 3663 | | |
3666 | 3664 | | |
| |||
3795 | 3793 | | |
3796 | 3794 | | |
3797 | 3795 | | |
3798 | | - | |
| 3796 | + | |
3799 | 3797 | | |
3800 | 3798 | | |
3801 | 3799 | | |
| |||
3863 | 3861 | | |
3864 | 3862 | | |
3865 | 3863 | | |
3866 | | - | |
| 3864 | + | |
3867 | 3865 | | |
3868 | 3866 | | |
3869 | 3867 | | |
| |||
4003 | 4001 | | |
4004 | 4002 | | |
4005 | 4003 | | |
4006 | | - | |
4007 | | - | |
4008 | | - | |
4009 | | - | |
4010 | 4004 | | |
4011 | 4005 | | |
4012 | 4006 | | |
| |||
4169 | 4163 | | |
4170 | 4164 | | |
4171 | 4165 | | |
4172 | | - | |
4173 | | - | |
4174 | | - | |
4175 | 4166 | | |
4176 | 4167 | | |
4177 | 4168 | | |
| |||
4224 | 4215 | | |
4225 | 4216 | | |
4226 | 4217 | | |
4227 | | - | |
4228 | | - | |
4229 | | - | |
4230 | 4218 | | |
4231 | 4219 | | |
4232 | 4220 | | |
| |||
4351 | 4339 | | |
4352 | 4340 | | |
4353 | 4341 | | |
4354 | | - | |
4355 | | - | |
4356 | | - | |
4357 | 4342 | | |
4358 | 4343 | | |
4359 | 4344 | | |
| |||
4765 | 4750 | | |
4766 | 4751 | | |
4767 | 4752 | | |
4768 | | - | |
| 4753 | + | |
4769 | 4754 | | |
4770 | 4755 | | |
0 commit comments