AlenkaF commented on code in PR #41956:
URL: https://github.com/apache/arrow/pull/41956#discussion_r1638057141


##########
cpp/src/arrow/array/array_nested.cc:
##########
@@ -847,30 +847,32 @@ Result<std::shared_ptr<Array>> 
MapArray::FromArraysInternal(
   const auto& typed_offsets = checked_cast<const OffsetArrayType&>(*offsets);
 
   BufferVector buffers;
-  int64_t null_count;
-  if (null_bitmap != nullptr) {
-    buffers = BufferVector({std::move(null_bitmap), typed_offsets.values()});
-    null_count = null_bitmap->size();
-  } else {
-    buffers = BufferVector({null_bitmap, typed_offsets.values()});
-    null_count = 0;
+  buffers.resize(2);
+  int64_t null_count = 0;
+  if (null_bitmap) {
+    buffers[0] = std::move(null_bitmap);
+    null_count = kUnknownNullCount;
   }
+  buffers[1] = typed_offsets.values();
   return std::make_shared<MapArray>(type, offsets->length() - 1, 
std::move(buffers), keys,
                                     items, /*null_count=*/null_count, 
offsets->offset());
 }
 
-Result<std::shared_ptr<Array>> MapArray::FromArrays(
-    const std::shared_ptr<Array>& offsets, const std::shared_ptr<Array>& keys,
-    const std::shared_ptr<Array>& items, MemoryPool* pool,
-    const std::shared_ptr<Buffer>& null_bitmap) {
+Result<std::shared_ptr<Array>> MapArray::FromArrays(const 
std::shared_ptr<Array>& offsets,
+                                                    const 
std::shared_ptr<Array>& keys,
+                                                    const 
std::shared_ptr<Array>& items,
+                                                    MemoryPool* pool,
+                                                    std::shared_ptr<Buffer> 
null_bitmap) {
   return FromArraysInternal(std::make_shared<MapType>(keys->type(), 
items->type()),
                             offsets, keys, items, pool, null_bitmap);
 }
 
-Result<std::shared_ptr<Array>> MapArray::FromArrays(
-    std::shared_ptr<DataType> type, const std::shared_ptr<Array>& offsets,
-    const std::shared_ptr<Array>& keys, const std::shared_ptr<Array>& items,
-    MemoryPool* pool, const std::shared_ptr<Buffer>& null_bitmap) {
+Result<std::shared_ptr<Array>> MapArray::FromArrays(std::shared_ptr<DataType> 
type,
+                                                    const 
std::shared_ptr<Array>& offsets,
+                                                    const 
std::shared_ptr<Array>& keys,
+                                                    const 
std::shared_ptr<Array>& items,
+                                                    MemoryPool* pool,
+                                                    std::shared_ptr<Buffer> 
null_bitmap) {

Review Comment:
   Aha! Thank you so much for explaining.
   And looking at my comment in this thread it looks like I doubt in what @kou 
suggested - on contrary! I was more curious why would `std::move` needs 
repeating 😊 So thanks again, will correct.



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