You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Marcos (Jira)" <ji...@apache.org> on 2023/12/11 12:55:00 UTC

[jira] [Created] (AVRO-3917) [Rust] Field aliases are not taken into account when calculating schema compatibility

Marcos created AVRO-3917:
----------------------------

             Summary: [Rust] Field aliases are not taken into account when calculating schema compatibility
                 Key: AVRO-3917
                 URL: https://issues.apache.org/jira/browse/AVRO-3917
             Project: Apache Avro
          Issue Type: Improvement
            Reporter: Marcos


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

 
{code:js}
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" ]}
     ]
}"#)?;
{code}
 
Then the compatibility gives the following *error*

{code:js}
assert!(SchemaCompatibility::can_read(&schema_v1, &schema_v2).is_err());

// Incompatible schemata! Field 'date' in reader schema must have a default value"
{code}

The error must not happen because *date* has the *time* alias



--
This message was sent by Atlassian Jira
(v8.20.10#820010)