zgramana commented on a change in pull request #7032:
URL: https://github.com/apache/arrow/pull/7032#discussion_r416089870



##########
File path: csharp/src/Apache.Arrow/Arrays/PrimitiveArrayBuilder.cs
##########
@@ -162,8 +188,8 @@ public TBuilder Swap(int i, int j)
         public TArray Build(MemoryAllocator allocator = default)
         {
             return Build(
-                ValueBuffer.Build(allocator), ArrowBuffer.Empty,
-                ValueBuffer.Length, 0, 0);
+                ValueBuffer.Build(allocator), 
ValidityBuffer.Build(allocator).ValueBuffer,

Review comment:
       I agree with the sentiment, but given that every call to `Append[Range]` 
also touches `ValidityBuffer` I think this could end up trading-off a modest 
memory utilization improvement for [a modest-to-significant compute 
overhead](https://gist.github.com/mrange/aa82d33e94ad76d0f33ed86e704d7492) 
depending on the desired level of thread-safety and a given application's 
access pattern.
   
   That said, `Build` could easily pass an empty buffer if `NullCount` == 0. 
Then `ArrowStreamWriter` could check the buffer's span `IsEmpty` property, and 
if so, emit [NullType 
instead](https://issues.apache.org/jira/browse/ARROW-6643).




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to