matan129 opened a new pull request, #850:
URL: https://github.com/apache/arrow-go/pull/850
### Rationale for this change
`appendBinaryData` has no case for `[]byte`, so a plain bytes value falls
into the`fmt.Append` fallback, which results in a string-formated value.
```go
schema :=
`{"type":"record","name":"r","fields":[{"name":"f","type":"bytes"}]}`
var buf bytes.Buffer
enc, _ := ocf.NewEncoder(schema, &buf)
enc.Encode(map[string]any{"f": []byte{0x00, 0x01, 0xfe, 0xff}})
enc.Close()
r, _ := avro.NewOCFReader(&buf, avro.WithChunk(-1))
r.Next()
fmt.Printf("%x\n", r.RecordBatch().Column(0).(*array.Binary).Value(0))
// got: 5b30203120323534203235355d — the 13-byte text "[0 1 254 255]"
// want: 0001feff
```
### What changes are included in this PR?
- `appendBinaryData`: append `[]bytes` as is & append `string` as its raw
bytes
- `appendStringData`: handle `[]byte`.
- `testdata.ByteArray.MarshalJSON`: Remove `fmt.Sprint(<bytes>)` to match
the new behaviour
### Are these changes tested?
Yes. Added regression test: `TestOCFReaderBytesValues` covering plain bytes
and `["null","bytes"]`
### Are there any user-facing changes?
Yes. Avro bytes columns previously decoded to corrupted text now decode to
the actual payload.
--
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]