Commit ef51f11
authored
[Variant] Reverse VariantAsPrimitive trait to PrimitiveFromVariant (#8519)
# Which issue does this PR close?
- Relates to #8515
- Relates to #8516
# Rationale for this change
The existing `VariantAsPrimitive` trait is kind of "backward" and
requires very complex type bounds to use, e.g.:
```rust
impl<'a, T> VariantToPrimitiveArrowRowBuilder<'a, T>
where
T: ArrowPrimitiveType,
for<'m, 'v> Variant<'m, 'v>: VariantAsPrimitive<T>,
```
This is a code smell.
# What changes are included in this PR?
"Reverse" the trait -- instead of extending `Variant`, the trait extends
`T: ArrowPrimitiveType`. The resulting type bounds are much more
intuitive:
```rust
impl<'a, T: PrimitiveFromVariant> VariantToPrimitiveArrowRowBuilder<'a, T>
```
# Are these changes tested?
Existing unit tests cover this refactor.
# Are there any user-facing changes?
No.1 parent d7a871f commit ef51f11
File tree
2 files changed
+28
-69
lines changed- parquet-variant-compute/src
2 files changed
+28
-69
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
37 | | - | |
38 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
93 | 50 | | |
94 | 51 | | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
100 | 63 | | |
101 | 64 | | |
102 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
298 | 298 | | |
299 | 299 | | |
300 | 300 | | |
301 | | - | |
| 301 | + | |
302 | 302 | | |
303 | 303 | | |
304 | 304 | | |
305 | 305 | | |
306 | | - | |
| 306 | + | |
307 | 307 | | |
308 | 308 | | |
309 | 309 | | |
| |||
312 | 312 | | |
313 | 313 | | |
314 | 314 | | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
| 315 | + | |
320 | 316 | | |
321 | 317 | | |
322 | 318 | | |
323 | 319 | | |
324 | 320 | | |
325 | 321 | | |
326 | | - | |
| 322 | + | |
327 | 323 | | |
328 | 324 | | |
329 | 325 | | |
| |||
0 commit comments