Repository navigation
Commit 295fae6
committed
Support wide decimals in
`DecimalBytePartsArray` previously stored the entire unscaled decimal
value in one signed integer child, limiting it to values that fit in 64
bits. It now supports wide decimals by representing each value as
integer parts that can be compressed independently, while preserving the
decimal's logical precision, scale, and nullability.
The array has a signed most significant part (MSP) and up to three
unsigned 64-bit lower parts, ordered most significant first. Splitting
canonical decimal storage produces:
| Decimal storage | Children |
| --- | --- |
| `i8` / `i16` / `i32` / `i64` | Signed MSP only; shares the original
value buffer |
| `i128` | `i64` MSP + one `u64` lower part |
| `i256` | `i64` MSP + three `u64` lower parts |
Only the MSP carries validity. Every lower part must be a non-nullable
`u64` array with the same length, and splitting wide decimals zeroes the
parts at null positions. All children remain `ArrayRef`s, so their
individual encodings are independent of the decimal representation.
`execute::<DecimalArray>` reassembles a `DecimalArray` from the MSP and
lower parts children.
`take` with nullable indices is not yet supported by the
DecimalByteParts kernel for arrays with lower parts; it falls back to
canonical execution. Taking each part directly would make the lower
parts nullable, violating the representation's invariant. The frozen
serializer also continues to reject arrays with lower parts.
This PR also refines the splitting and assembly modules.
* Assembly takes `ArrayRef`s instead of `PrimitiveArray`s so that in the
future, we can add special fast paths for constant arrays
* Assembly casts lower parts to `u64`s, allowing for assembly of
narrowed lower parts.
* Assembly loop is optimized such that it vectorizes for `i256` assembly
on local runs.
---------
Signed-off-by: Matt Katz <mhkatz97@gmail.com>DecimalBytePartsArray and kernels (#9809)1 parent bad88ce commit 295fae6
28 files changed
Lines changed: 2626 additions & 1106 deletions
File tree
- encodings/decimal-byte-parts
- benches
- common
- src/decimal_byte_parts
- compute
- limbs
- vortex-array/src/dtype/bigint
- vortex-btrblocks/src
- vortex-cuda/src/kernel/encodings
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
55 | 57 | | |
56 | 58 | | |
57 | 59 | | |
| |||
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 | |
|---|---|---|---|
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
| 179 | + | |
179 | 180 | | |
180 | 181 | | |
181 | 182 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| 34 | + | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
11 | 9 | | |
12 | 10 | | |
13 | | - | |
14 | 11 | | |
15 | | - | |
16 | 12 | | |
17 | 13 | | |
18 | | - | |
| 14 | + | |
19 | 15 | | |
20 | 16 | | |
21 | 17 | | |
22 | 18 | | |
23 | 19 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
| 20 | + | |
29 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
30 | 48 | | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
37 | 54 | | |
38 | 55 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
48 | 75 | | |
49 | | - | |
50 | 76 | | |
51 | 77 | | |
0 commit comments