emkornfield commented on a change in pull request #11359: URL: https://github.com/apache/arrow/pull/11359#discussion_r741356787
########## File path: go/arrow/array/binary.go ########## @@ -117,6 +118,21 @@ func (a *Binary) setData(data *Data) { } } +func (a *Binary) getOneForMarshal(i int) interface{} { + if a.IsNull(i) { + return nil + } + return a.Value(i) +} + +func (a *Binary) MarshalJSON() ([]byte, error) { + vals := make([]interface{}, a.Len()) + for i := 0; i < a.Len(); i++ { + vals[i] = a.getOneForMarshal(i) + } + return json.Marshal(vals) Review comment: How do non-printable characters get marshalled in json? Escaped bytes? ########## File path: go/arrow/array/binary.go ########## @@ -117,6 +118,21 @@ func (a *Binary) setData(data *Data) { } } +func (a *Binary) getOneForMarshal(i int) interface{} { + if a.IsNull(i) { + return nil + } + return a.Value(i) +} + +func (a *Binary) MarshalJSON() ([]byte, error) { + vals := make([]interface{}, a.Len()) + for i := 0; i < a.Len(); i++ { + vals[i] = a.getOneForMarshal(i) + } + return json.Marshal(vals) Review comment: Okay, based on below is looks like base64 encoded? This is not something I could find as a reference in the docs? ########## File path: go/arrow/array/decimal128.go ########## @@ -229,6 +253,67 @@ func (b *Decimal128Builder) newData() (data *Data) { return } +func (b *Decimal128Builder) unmarshalOne(dec *json.Decoder) error { + t, err := dec.Token() + if err != nil { + return err + } + + var out *big.Float + + switch v := t.(type) { + case float64: + out = big.NewFloat(v) + case string: + out, _, err = big.ParseFloat(v, 10, 0, big.ToNearestAway) Review comment: any strong rationale for ToNearestAway? maybe document? ########## File path: go/arrow/array/decimal128.go ########## @@ -229,6 +253,67 @@ func (b *Decimal128Builder) newData() (data *Data) { return } +func (b *Decimal128Builder) unmarshalOne(dec *json.Decoder) error { + t, err := dec.Token() + if err != nil { + return err + } + + var out *big.Float + + switch v := t.(type) { + case float64: + out = big.NewFloat(v) + case string: + out, _, err = big.ParseFloat(v, 10, 0, big.ToNearestAway) Review comment: any strong rationale for ToNearestAway? maybe document? -- 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