Allocate a buffer of the correct length for ScalarValue::FixedSizeBinary in ScalarValue::to_array_of_size #18903
+29
−10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
ScalarValue::to_array_of_sizeDoes Not Correctly Allocate a Values Buffer forScalarValue::FixedSizeBinary#18870.We should open a follow-up issue that tracks re-use
FixedSizeBinaryArray::new_nullafter 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?
assert_eq!(result.as_fixed_size_binary().values().len(), 10);returned 0 before)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.