js8544 commented on code in PR #36891:
URL: https://github.com/apache/arrow/pull/36891#discussion_r1308443801
##########
cpp/src/arrow/array/util.cc:
##########
@@ -538,7 +538,7 @@ class NullArrayFactory {
out_->buffers.resize(3);
out_->buffers[2] = buffer_;
- child_length = 1;
+ child_length = length_ > 0 ? 1 : 0;
Review Comment:
Added a test that would fail with
```
Failed 'list_union_nulls->ValidateFull()' failed with Invalid: List child
array invalid: Invalid: Union child array #0 invalid: Invalid: Offsets buffer
size (bytes): 4 isn't large enough for length: 1 and offset: 0
/home/jinshang/arrow/cpp/src/arrow/array/validate.cc:566
ValidateOffsets(type, values.size())
/home/jinshang/arrow/cpp/src/arrow/array/validate.cc:157
ValidateBinaryLike(type)
```
without this change. Comment is updated too.
--
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]