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

[Java] Fully qualified type reference "ns.int" loses namespace.

    XMLWordPrintableJSON

Details

    Description

      While brainstorming for AVRO-3370, I came across this special case where a type-reference could be considered ambiguous if the SDK is not careful when simplifying inherited namespaces:

      {
        "type" : "record",
        "name" : "ns.int",
        "fields" : [ 
          {"name" : "value", "type" : "int"}, 
          {"name" : "next", "type" : [ "null", "ns.int" ]}
        ]
      }
      

      In Java, if this code is parsed, it works as expected (as a linked list).

      If the schema is turned to a String using toString(), the namespace is dropped off the last ns.int, turning it into the primitive. That string can still be parsed into a Schema, but the "round-trip" modifies the schema in an incompatible way.

      That namespace shouldn't be dropped when producing the JSON string representing the Schema in Java.

      Attachments

        1. AVRO-3374.patch
          3 kB
          Christophe Le Saec

        Issue Links

          Activity

            People

              clesaec Christophe Le Saec
              rskraba Ryan Skraba
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h
                  1h