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

C++ resolving decoder doesn't work when reader schema has more fields than writer schema

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.7.6
    • Fix Version/s: None
    • Component/s: c++
    • Labels:
      None

      Description

      When reader schema has more number of fields than writer schema, C++ implementation of resolving decoder is throwing exception "throwing exception "Don't know how to handle excess fields for reader.” with out checking whether fields are optional or fields have default values.

      Attached are reader and writer schemas. Record in reader schema has 2 additional fields than writer schema. One field is required field but it has default value and another one is optional field (union of null and string). Since one has default value and another is optional both reader and writer schemas are supposed to be compatible.

      {"name": "defaultField", "type": "string", "default": "DEFAULT", "declared":"true"}

      ,

      {"name": "optionalField", "type": ["string", "null"],"declared":"true"}

      ,

      main()
      {
      avro::ValidSchema readerSchema = load("reader.json");
      avro::ValidSchema writerSchema = load("writer.json");
      avro::DecoderPtr d = avro::resolvingDecoder(writerSchema, readerSchema,avro::binaryDecoder());
      }

      But when I tried to create resolving decoder, I am getting "Don't know how to handle excess fields for reader.” But Java implementation works.

      Also field ordering is not working.

      The same issue is reported in AVRO-1360.

        Attachments

        1. AVRO-1474-REUSE-RD.patch
          1 kB
          Ramana Suvarapu
        2. AVRO-1474-MAP.patch
          3 kB
          Ramana Suvarapu
        3. AVRO-1474-ENUM.patch
          1 kB
          Ramana Suvarapu
        4. AVRO-1474-ResolvingDecoder.patch
          3 kB
          Ramana Suvarapu
        5. bigrecord_r
          4 kB
          Ramana Suvarapu
        6. bigrecord
          2 kB
          Ramana Suvarapu
        7. AVRO-1474.patch
          72 kB
          Thiruvalluvan M. G.
        8. writer
          1 kB
          Ramana Suvarapu
        9. reader
          2 kB
          Ramana Suvarapu

          Issue Links

            Activity

              People

              • Assignee:
                thiru_mg Thiruvalluvan M. G.
                Reporter:
                ramanasv Ramana Suvarapu
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: