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

Enhance schema parser to allow arbitrary properties to be defined on a record field

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 1.4.0
    • java, spec
    • None
    • All

    • Reviewed

    Description

      It's currently not possible to add an arbitrary property on a record field. e.g., in the following example, although the schema parses fine, the "alias" property gets thrown away:

      {
      "name": "KVPair",
      "type": "record",
      "fields" : [

      {"name": "key", "type": "int", "alias": "EventTime"}

      ,

      {"name": "values", "type": "bytes"}

      ]
      }

      I had read the Avro spec and thought this was actually allowed ("Attributes not defined in this document are permitted as metadata, but must not affect the format of serialized data.") but it appears that such additional properties are only allowed at the schema level, not at the field level too.

      This would be a really useful feature to have, as it would allow the user to define meta-data on a field. Currently the only other way to achieve the same behavior would be to do some kind of hack using the field's "doc" attribute, which would be rather ugly.

      Attachments

        1. AVRO-601.patch
          9 kB
          Doug Cutting
        2. AVRO-601.patch
          9 kB
          Doug Cutting
        3. AVRO-601.patch
          9 kB
          Doug Cutting
        4. AVRO-601.patch
          8 kB
          Doug Cutting

        Activity

          People

            cutting Doug Cutting
            darose David Rosenstrauch
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: