zeroshade commented on code in PR #833:
URL: https://github.com/apache/arrow-go/pull/833#discussion_r3866128860
##########
arrow/array/util.go:
##########
@@ -296,7 +296,11 @@ func RecordToJSON(rec arrow.RecordBatch, w io.Writer)
error {
cols := make(map[string]interface{})
for i := 0; int64(i) < rec.NumRows(); i++ {
for j, c := range rec.Columns() {
- cols[fields[j].Name] = c.GetOneForMarshal(i)
+ if rec.Schema().Field(j).Nullable && c.IsNull(i) {
Review Comment:
**Blocking:** This condition does not prevent invalid non-nullable nulls
from being serialized: when the field is non-nullable and `c.IsNull(i)` is
true, execution falls through to `GetOneForMarshal`, which returns `nil`. I
reproduced `RecordToJSON` succeeding with `{"x":null}`;
`Struct.GetOneForMarshal` likewise emits `[{"x":null}]`, while the updated
readers reject both. Please reject invalid non-nullable data during
serialization (or otherwise define consistent reader/writer behavior) and cover
both record and struct round trips.
--
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]