linkedin / linkedin/goavro

Schema with union and NativeFromBinary() map

Open
#215 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
1.1k
Forks
232
PR merge metrics
No merged PRs in 30d

Description

Hi @karrick (I'm hoping you are still around here)

I saw that you've strictly followed the Avro specification in order to develop/maintain this go module. About the JSON encoding, I've seen some complaining about the TextualFromNative() inserting types fields for union Avro types (i.e. #167 and #106). For what I've seen on the specification, these types fields should exist, because TextualFromNative?() use a JSON format.

My question is about NativeFromBinary(). I'm getting type fields in the interface{} returned from it. Shouldn't these types only be added for JSON encoding? The Native is a map (or interface{}) object in go, not a JSON, right?

If an example is required, there is one in the function description.

//             {
//               "type": "record",
//               "name": "LongList",
//               "fields" : [
//                 {"name": "next", "type": ["null", "LongList"], "default": null}
//               ]
//             }
//        (...)
//         binary := []byte{0x2, 0x2, 0x0}
//
//         native, _, err := codec.NativeFromBinary(binary)
//         if err != nil {
//             fmt.Println(err)
//         }
//
//         fmt.Printf("%v", native)
//         // Output: map[next:map[LongList:map[next:map[LongList:map[next:<nil>]]]]]

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at NativeFromBinary and the LongList union example in the issue description. Compare the returned interface{} structure with the linked Avro JSON encoding specification and related issues #167 and #106. Done means establishing whether union type fields are expected in native binary decoding and recording the project decision.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
data-engineering
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.