mapleFU commented on code in PR #38839:
URL: https://github.com/apache/arrow/pull/38839#discussion_r1401504398


##########
go/arrow/array/data.go:
##########
@@ -190,6 +190,24 @@ func (d *Data) SetDictionary(dict arrow.ArrayData) {
        }
 }
 
+// Returns the size of Data in bytes
+func (d *Data) Size() uint64 {
+       var size uint64

Review Comment:
   fmt?



##########
go/arrow/array/data.go:
##########
@@ -190,6 +190,24 @@ func (d *Data) SetDictionary(dict arrow.ArrayData) {
        }
 }
 
+// Returns the size of Data in bytes
+func (d *Data) Size() uint64 {
+       var size uint64
+
+    if d == nil {
+        return 0
+    }
+
+    for _, b := range d.Buffers() {
+        size += uint64(b.Len())
+    }
+    for _, c := range d.Children() {
+        size += c.Size()
+    }
+    size += d.Dictionary().Size()

Review Comment:
   Could `Dictionary` be `nil`?



##########
go/arrow/array.go:
##########
@@ -81,6 +81,8 @@ type ArrayData interface {
        // Dictionary returns the ArrayData object for the dictionary if this 
is a
        // dictionary array, otherwise it will be nil.
        Dictionary() ArrayData
+       // Size() returns the size of the ArrayData in bytes.
+       Size() uint64

Review Comment:
   `Size` is ambigious and looks like `Len`, would something like `SizeInBytes` 
better?



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