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

Schema for fixed types corrupted when writing out in JSON format

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.7.0, 1.7.1, 1.7.2, 1.7.3, 1.7.4
    • Fix Version/s: 1.7.7
    • Component/s: c++
    • Labels:

      Description

      A change made in NodeImpl.cc under AVRO-1026 has introduced a bug that corrupts JSON schemas when writing them to disk or dumping to a stream. This manifested when using DataFileWriter to generate a data file, and the schema stored in the header was corrupted from the original schema provided.

      e.g

      This:

      {
        “type”: “fixed”,
        “name”: “Unsigned16”,
        “size”: 2
      }
      

      Becomes this:

      {
        “type”: “fixed”,
        “size”: 2,
        “name” : “Unsigned16”,
      }
      

      Note the extraneous comma after the ‘name’ attribute.
      The bug exists for Avro 'fixed' types, and has not been observed for other types. A test case will be developed.

      The bug can be fixed by simply re-ordering the code in NodeFixed::printJson.

        Attachments

        1. AVRO-1352.patch
          0.5 kB
          Steve Roehrs
        2. AVRO-1352-Test.patch
          2 kB
          Steve Roehrs

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              roehrss Steve Roehrs
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

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