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

Convert JSON Text Input to Avro Tool

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Patch Available
    • Major
    • Resolution: Unresolved
    • None
    • None
    • java
    • None

    Description

      The attached patch allows reading a JSON-formatted text file in, converting to a conforming Avro text file, emitting one record per line, e.g., it can read this input file:

      {"intval":12} {"intval":-73,"strval":"hello, there!!"}

      with this schema:
      { "type":"record", "name":"TestRecord", "fields": [

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

      ,

      {"name":"strval","type":["string", "null"]}

      ]}

      returning valid Avro. This is different than the DataFileWriteTool, which would read in the following internal encoding:

      {"intval":12,"strval":null}

      {"intval":-73,"strval":{"string":"hello, there!!"}}

      In general, the internal encodings used by Avro aren't natural when reading in JSON text that appears in the wild. Likewise, this utility allows changing invalid Avro identifier characters into an underscore, again to tolerate JSON that wasn't designed to be readable by Avro.

      Attachments

        1. AVRO-672.patch
          18 kB
          Ron Bodkin
        2. AVRO-672.patch
          9 kB
          Doug Cutting

        Activity

          People

            Unassigned Unassigned
            rbodkin Ron Bodkin
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: