zeroshade commented on a change in pull request #11359:
URL: https://github.com/apache/arrow/pull/11359#discussion_r741377810



##########
File path: go/arrow/array/fixed_size_list.go
##########
@@ -110,6 +112,44 @@ func (a *FixedSizeList) Release() {
        a.values.Release()
 }
 
+func (a *FixedSizeList) getOneForMarshal(i int) interface{} {
+       if a.IsNull(i) {
+               return nil
+       }
+       slice := a.newListValue(i)
+       defer slice.Release()
+       v, err := json.Marshal(slice)
+       if err != nil {
+               panic(err)
+       }
+
+       return json.RawMessage(v)
+}
+
+func (a *FixedSizeList) MarshalJSON() ([]byte, error) {
+       var buf bytes.Buffer
+       enc := json.NewEncoder(&buf)
+
+       buf.WriteByte('[')

Review comment:
       No, it's just encoding a fixed size list identically to how it encodes 
regular lists, as a nested list. From the perspective of JSON there's no 
difference between a `List` where all of the lists happen to be the same 
length, and a `FixedSizeList`. A fixed size list with `n=3` of Int would encode 
in json as `[ [1,2,3], [4,5,6], [7,8,9] ]`




-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to