Commit 897b5c1
feat: support repartitioning of FFI execution plans (apache#20449)
## Which issue does this PR close?
This is a blocker for apache#20450
## Rationale for this change
This PR introduces an important concept in the FFI work to avoids
creating wrappers upon wrappers of plans. It was discovered as part of
the work to create FFI physical optimizer rules. Suppose we have a
foreign plan. Then we attempt to turn this into an FFI plan. What we
will end up with currently is a FFI plan where the underlying private
data is a foreign plan that additionally contains a FFI plan. Instead
*any* time we are creating an FFI object we should check to see if it is
locally downcastable to a Foreign plan and if so to just access the
already existing FFI object.
This pattern is adapted across all FFI objects in this PR.
With this work in place we can also properly support repartioning via
FFI as well as `new_with_children` via FFI.
## What changes are included in this PR?
- Adds access pattern for creating new FFI objects. When they are
already a locally downcastable to a Foreign wrapper then we simply get
the underlying existing FFI object instead of creating a wrapper around
a wrapper.
- Implement repartitioning and new_with_children via FFI on execution
plans.
## Are these changes tested?
Integration tests are added.
## Are there any user-facing changes?
The one use facing change is that for some of the aggregates and
accumulators that take in closures we require these closures to be
static so that we can downcast the boxed traits.
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>1 parent c792700 commit 897b5c1
File tree
29 files changed
+429
-97
lines changed- datafusion
- catalog/src
- expr-common/src
- expr/src
- ffi
- src
- physical_expr
- proto
- session
- tests
- udaf
- udf
- udwf
- tests
- functions-aggregate-common/src/aggregate/groups_accumulator
- functions-aggregate/src
- proto/src
- logical_plan
- physical_plan
- spark/src/function/aggregate
29 files changed
+429
-97
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
486 | 486 | | |
487 | 487 | | |
488 | 488 | | |
489 | | - | |
| 489 | + | |
490 | 490 | | |
491 | 491 | | |
492 | 492 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
| 111 | + | |
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
| 93 | + | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
250 | 250 | | |
251 | 251 | | |
252 | 252 | | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
253 | 258 | | |
254 | 259 | | |
255 | 260 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
215 | 222 | | |
216 | 223 | | |
217 | 224 | | |
| |||
0 commit comments