Commit 4cfe20f
authored
Allocate a buffer of the correct length for ScalarValue::FixedSizeBinary in ScalarValue::to_array_of_size (#18903)
## Which issue does this PR close?
- Closes #18870.
We should open a follow-up issue that tracks re-use
`FixedSizeBinaryArray::new_null` after upgrading arrow-rs.
With this PR, we could backport it to #18843 if we wish.
Alternatively, we could also wait for a fix by arrow-rs.
## Rationale for this change
As we will have to wait for another arrow-rs update to get the fix for
the issue apache/arrow-rs#8901 , we have a
temporaray fix that basically calls the same operations from
DataFusion's code. Once the fix is in the arrow-rs codebase, we can
re-use `FixedSizeBinaryArray::new_null`.
## What changes are included in this PR?
- A test. (`assert_eq!(result.as_fixed_size_binary().values().len(),
10);` returned 0 before)
- Directly allocate the values buffer in DataFusion.
## Are these changes tested?
Yes
## Are there any user-facing changes?
Yes, the buffer will now be allocated, zeroed, and set to the expected
length. Same as in the arrow-rs fix.1 parent e54eb42 commit 4cfe20f
1 file changed
+30
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| |||
3059 | 3059 | | |
3060 | 3060 | | |
3061 | 3061 | | |
3062 | | - | |
| 3062 | + | |
| 3063 | + | |
| 3064 | + | |
| 3065 | + | |
| 3066 | + | |
| 3067 | + | |
| 3068 | + | |
| 3069 | + | |
3063 | 3070 | | |
3064 | 3071 | | |
3065 | 3072 | | |
| |||
5317 | 5324 | | |
5318 | 5325 | | |
5319 | 5326 | | |
| 5327 | + | |
| 5328 | + | |
| 5329 | + | |
| 5330 | + | |
| 5331 | + | |
| 5332 | + | |
| 5333 | + | |
| 5334 | + | |
| 5335 | + | |
| 5336 | + | |
| 5337 | + | |
| 5338 | + | |
5320 | 5339 | | |
5321 | 5340 | | |
5322 | 5341 | | |
| |||
0 commit comments