Commit 1d874fa
ARROW-11005: [Rust] Remove indirection from
This PR is a small cleanup of the `take` kernel.
1. replaces `&Arc<Array>` by `&Array`. This is a small change in the API, but makes it more obvious that the only requirements for `take` is implementing the trait `Array`.
2. internal concrete implementations of `take` are no longer `dyn`, and instead expect the corresponding array types and return the corresponding array types.
3. Clarified in the documentation that not performing bound checks can lead to undefined behavior.
4. Added equality for `FixedSizeListArray`, that was missing.
The rational for this PR is that it makes it more obvious the design of the module: each array type has its own implementation (e.g. `take_primitive<T>(array: &PrimitiveArray<T>, indices: ...) -> PrimitiveArray<T>`), and there is one `dyn` implementation, `take(array: &Array, indices: ...) -> ArrayRef`, that uses each type-specific implementation and wraps it on an `Arc<Array>` for the `dyn` behavior. This is mostly for simplicity and readability, but we could expose these methods publicly.
Closes #8985 from jorgecarleitao/simpler_take
Authored-by: Jorge C. Leitao <[email protected]>
Signed-off-by: Andrew Lamb <[email protected]>take kernel1 parent 53a36f5 commit 1d874fa
File tree
7 files changed
+186
-163
lines changed- rust
- arrow
- benches
- src
- array/equal
- compute/kernels
- datafusion/src/physical_plan
7 files changed
+186
-163
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
27 | 25 | | |
28 | 26 | | |
29 | 27 | | |
| |||
32 | 30 | | |
33 | 31 | | |
34 | 32 | | |
35 | | - | |
| 33 | + | |
36 | 34 | | |
37 | 35 | | |
38 | 36 | | |
39 | 37 | | |
40 | 38 | | |
41 | | - | |
| 39 | + | |
42 | 40 | | |
43 | 41 | | |
44 | 42 | | |
45 | | - | |
46 | | - | |
47 | | - | |
| 43 | + | |
48 | 44 | | |
49 | 45 | | |
50 | 46 | | |
51 | | - | |
| 47 | + | |
52 | 48 | | |
53 | 49 | | |
54 | 50 | | |
55 | | - | |
| 51 | + | |
56 | 52 | | |
57 | 53 | | |
58 | 54 | | |
59 | | - | |
60 | | - | |
61 | | - | |
| 55 | + | |
62 | 56 | | |
63 | 57 | | |
64 | | - | |
| 58 | + | |
65 | 59 | | |
66 | 60 | | |
67 | 61 | | |
| |||
74 | 68 | | |
75 | 69 | | |
76 | 70 | | |
77 | | - | |
| 71 | + | |
78 | 72 | | |
79 | 73 | | |
80 | 74 | | |
| |||
91 | 85 | | |
92 | 86 | | |
93 | 87 | | |
94 | | - | |
95 | | - | |
| 88 | + | |
| 89 | + | |
96 | 90 | | |
97 | 91 | | |
98 | 92 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
116 | 117 | | |
117 | 118 | | |
118 | 119 | | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
119 | 126 | | |
120 | 127 | | |
121 | 128 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1123 | 1123 | | |
1124 | 1124 | | |
1125 | 1125 | | |
1126 | | - | |
| 1126 | + | |
1127 | 1127 | | |
1128 | 1128 | | |
1129 | 1129 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
626 | 626 | | |
627 | 627 | | |
628 | 628 | | |
629 | | - | |
| 629 | + | |
630 | 630 | | |
631 | 631 | | |
632 | 632 | | |
| |||
0 commit comments