linkedin / linkedin/goavro

Inconsistent serialization behavior w.r.t java

Open
#184 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

Test code:

package main

import (
    "fmt"
    "github.com/linkedin/goavro"
)


func main() {
    codec, err := goavro.NewCodec(`
            {
              "type": "record",
              "name": "LongList",
              "fields" : [
      {"name": "foo", "type": "string", "default": "foo"},
      {"name": "bar", "type": "string", "default": "bar"}
              ]
            }`)
    if err != nil {
        fmt.Println(err)
    }

    // NOTE: May omit fields when using default value
    textual := []byte(`{"foo":"foo"}`)

    // Convert textual Avro data (in Avro JSON format) to native Go form
    native, _, err := codec.NativeFromTextual(textual)
    if err != nil {
        fmt.Println(err)
    }

    print(native.(map[string]interface{})["bar"].(string))

}

This code prints bar.

Same test case with java avro-tools fails.

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 with the supplied Go program, especially goavro.NewCodec and NativeFromTextual, using the shown schema and textual input. Compare its handling of the omitted bar field with java avro-tools; done means the implementations agree and the behavior is covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, java
Domain
data-engineering
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.