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

[Rust] Field aliases are not taken into account when calculating schema compatibility

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 1.12.0, 1.11.4
    • None

    Description

      When calculating the schema compatibility field aliases are not taken into account to calculate the end result, for example:

      The compatibility result for following schemas (writer schema_v1 and reader schema_v2) must be Ok(()), but it is not the case

       

      let schema_v1 = Schema::parse_str(r#"
      {
      
          "type": "record",
          "name": "Conference",
          "namespace": "advdaba",
           "fields": [
               {"type": "string", "name": "name"},
               {"type": "long", "name": "time"}
           ]
      
      }"#)?;
      
      let schema_v2 = Schema::parse_str(r#"
      {
          "type": "record",
          "name": "Conference",
          "namespace": "advdaba",
           "fields": [
               {"type": "string", "name": "name"},
               {"type": "long", "name": "date", "aliases" : [ "time" ]}
           ]
      }"#)?;
      

       
      Then the compatibility gives the following error

      assert!(SchemaCompatibility::can_read(&schema_v1, &schema_v2).is_err());
      
      // Incompatible schemata! Field 'date' in reader schema must have a default value"
      

      The error must not happen because date has the time alias

      Attachments

        Issue Links

          Activity

            People

              mgrigorov Martin Tzvetanov Grigorov
              marcosschroh Marcos Schroh
              Votes:
              0 Vote for this issue
              Watchers:
              2 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 - 1h 40m
                  1h 40m