Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-1872

Using union in nodejs, when has several different names in the union's record will report the Error at this time: ambiguous unwrapped the union, but the same protocol in Java: no problem

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.8.1
    • None
    • java, javascript, js
    • None
    • node.js

    Description

      protocol eg:
      {
      "protocol": "Test",
      "namespace": "test.avro",
      "types": [
      {
      "type": "record",
      "name": "AAA",
      "fields": [

      { "name": "a", "type": "string" }

      ]
      },
      {
      "type": "record",
      "name": "BBB",
      "fields": [

      { "name": "b", "type": "string" }

      ,

      { "name": "a", "type": "AAA" }

      ]
      },
      {
      "type": "record",
      "name": "CCC",
      "fields": [

      { "name": "c", "type": "string" }

      ,

      { "name": "t", "type": "int" }

      ]
      },
      {
      "type": "record",
      "name": "DDD",
      "fields": [

      { "name": "temp", "type": "string" }

      ,

      { "name": "d", "type": [ "null", "BBB", "CCC" ] }

      ]
      }
      ],
      "messages": {}
      }

      in java use cmd:java -jar D:\workspace-mars2\Avro\lib\avro-tools-1.8.1.jar compile protocol D:\new\Test.avpr D:\new is ok.

      but in node.js code:

      var avro = require("D:\\Soft\\nodejs\\node_modules
      avsc");
      var protocol = avro.parse("./Test.avpr");

      Prompt error message as below:

      D:\Soft\nodejs\node_modules\avsc\lib\types.js:918
      throw new Error(f('ambiguous unwrapped union: %j', this));
      Error: ambiguous unwrapped union:["null",{"name":"test.avro.BBB","type":"record","fields":[

      {"name":"b","type":"string","order":"ascending","aliases":[]}

      ,{"name":"a","type":{"name":"test.avro.AAA","type":"record","fields":[

      {"name":"a","type":"string","order":"ascending","aliases":[]}

      ],"aliases":[]},"order":"ascending","aliases":[]}],"aliases":[]},{"name":"test.avro.CCC","type":"record","fields":[

      {"name":"c","type":"string","order":"ascending","aliases":[]}

      ,

      {"name":"t","type":"int","order":"ascending","aliases":[]}

      ],"aliases":[]}]

      it is bug?

      Attachments

        Activity

          People

            mtth Matthieu Monsch
            chunfy.tseng Chunfy.Tseng
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: