Skip to content

Commit

Permalink
Fix null record handling in zio/zjsonio.Reader (#4852)
Browse files Browse the repository at this point in the history
  • Loading branch information
nwt authored Nov 9, 2023
1 parent 7604371 commit 9f9087b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions zed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func TestZed(t *testing.T) {
runAllBoomerangs(t, "arrows", data)
runAllBoomerangs(t, "parquet", data)
runAllBoomerangs(t, "vng", data)
runAllBoomerangs(t, "zjson", data)
runAllBoomerangs(t, "zson", data)
})

Expand Down
4 changes: 4 additions & 0 deletions zio/zjsonio/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ func (r *Reader) decodeValue(b *zcode.Builder, typ zed.Type, body interface{}) e
case *zed.TypeEnum:
return r.decodeEnum(b, typ, body)
case *zed.TypeRecord:
if body == nil {
b.Append(nil)
return nil
}
return r.decodeRecord(b, typ, body)
case *zed.TypeArray:
err := r.decodeContainer(b, typ.Type, body, "array")
Expand Down
1 change: 1 addition & 0 deletions zio/zjsonio/ztests/vals.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ inputs:
null(int64)
null(string)
null(type)
null({})

outputs:
- name: stdout
Expand Down

0 comments on commit 9f9087b

Please sign in to comment.