felipecrv commented on code in PR #36018:
URL: https://github.com/apache/arrow/pull/36018#discussion_r1231504922
##########
cpp/src/arrow/array/data.cc:
##########
@@ -381,24 +381,29 @@ void ArraySpan::FillFromScalar(const Scalar& value) {
this->child_data[i].FillFromScalar(*scalar.value[i]);
}
} else if (is_union(type_id)) {
+ // Dense union needs scratch space to store both offsets and a type code
+ struct UnionScratchSpace {
+ uint8_t type_code;
+ alignas(int32_t) uint8_t offsets[sizeof(int32_t) * 2];
Review Comment:
If, out of caution, we want these pointers to have 64-bit alignment like
provided by `malloc`, the `type_code` should align to `int64_t`. As it is now,
you're using the second and third 4-byte block of the scratch space, when you
could use the third and fourth.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]