bkietz commented on code in PR #36018:
URL: https://github.com/apache/arrow/pull/36018#discussion_r1231117144


##########
cpp/src/arrow/array/data.cc:
##########
@@ -265,13 +266,12 @@ int GetNumBuffers(const DataType& type) {
 namespace internal {
 
 void FillZeroLengthArray(const DataType* type, ArraySpan* span) {
-  memset(span->scratch_space, 0x00, sizeof(span->scratch_space));
-
   span->type = type;
   span->length = 0;
   int num_buffers = GetNumBuffers(*type);
   for (int i = 0; i < num_buffers; ++i) {
-    span->buffers[i].data = reinterpret_cast<uint8_t*>(span->scratch_space);
+    static int64_t zero{0};
+    span->buffers[i].data = reinterpret_cast<uint8_t*>(&zero);

Review Comment:
   This buffer should never be read, let alone mutated. I tend to agree with 
you that this isn't ideal, but [BufferSpan is just always mutable](
   
https://github.com/bkietz/arrow/blob/f13a76ac35dc3586e9c2bd37770ccf22d3d15eb4/cpp/src/arrow/array/data.h#L356-L359)
 and we have to trust that nobody will misuse it



-- 
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]

Reply via email to