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

IDL Tool - Field properties are added against schema instead of field

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Invalid
    • 1.7.1
    • None
    • java
    • None
    • Hide
      Actually I realized you can annotate both the field schema and the field itself.

      string @Prop field

      Strange, but it works, so closing
      Show
      Actually I realized you can annotate both the field schema and the field itself. string @Prop field Strange, but it works, so closing

    Description

      In Idl.jj, field properties are added against the field schema instead of the field, resulting in an error if different fields of the same record
      type are annotated with the same property name.

      Example:
      <code>
      record RecordA {
      }

      record RecordB {
      @Prop("")
      RecordA a1

      @Prop("")
      RecordA a2
      }
      </code>

      Note this fails even if a1 and a2 are in different records (since the Schema instance is shared)

      Proposed fix: - change Idl.jj to add props agains the fields props, not the schema:

      <code>
      for (String key : props.keySet())
      type.addProp(key, getTextProp(key, props, token));
      </code>

      should read:
      <code>
      field.addProp(...)
      </code>

      Attachments

        Activity

          People

            Unassigned Unassigned
            copris Cristian Opris
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: