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

Rust Writer, Reader can't use Schemas with dependencies in other Schemas. i.e. The output of Schema::parse_list

    XMLWordPrintableJSON

Details

    Description

      Avro permits Schema definitions to reference Types defined in other Schema files. 

      Currently these can be parsed with Schema:parse_list, but the output of this can't be used in Writer, Reader,  (or to_avro_datum,  from_avro_datum)

      • These functions only take a single 'schema' and can't resolve the References
      • Schema:parse_list puts in 'refs' for the external dependencies, but doesn't seem to populate the UnionSchema's, so they can be resolved.

       

      Example of dependant schemas:
      letschema_TypeA=r#"
      {
      "type": "record",
      "namespace": "base.name.space",
      "name": "MultiSchemaTestTypeA",
      "fields":
      [

      { "name": "b", "type": ["null", "some.name.space.MultiSchemaTestTypeB"] }

      ,

      { "name": "c", "type":

      { "type": "map", "values": "some.name.space.MultiSchemaTestTypeB" }

      , "default": {}
      }
      ]
      }
      "#;

      letschema_TypeB=r#"
      {
      "type": "record",
      "namespace": "some.name.space",
      "name": "MultiSchemaTestTypeB",
      "fields":
      [

      { "name": "d", "type": "string" }

      ,

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

      ]
      }
      "#;
       

      PR Created with a failing test:  https://github.com/apache/avro/pull/1997

      Attachments

        Issue Links

          Activity

            People

              mgrigorov Martin Tzvetanov Grigorov
              MarkFarnan Mark Farnan
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

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