adamreeve commented on code in PR #41144:
URL: https://github.com/apache/arrow/pull/41144#discussion_r1560402492


##########
csharp/src/Apache.Arrow/Arrays/ArrayData.cs:
##########
@@ -28,12 +27,25 @@ public sealed class ArrayData : IDisposable
 
         public readonly IArrowType DataType;
         public readonly int Length;
-        public readonly int NullCount;
+        private int _nullCount;
         public readonly int Offset;
         public readonly ArrowBuffer[] Buffers;
         public readonly ArrayData[] Children;
         public readonly ArrayData Dictionary; // Only used for dictionary type
 
+        public int NullCount
+        {
+            get
+            {
+                if (_nullCount == RecalculateNullCount)
+                {
+                    _nullCount = ComputeNullCount();

Review Comment:
   This might result in duplicate work if multiple threads try to access the 
null count concurrently, but I don't imagine this is a big concern, and the C++ 
implementation has the same behaviour.



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