[ 
https://issues.apache.org/jira/browse/AVRO-3917?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17795669#comment-17795669
 ] 

ASF subversion and git services commented on AVRO-3917:
-------------------------------------------------------

Commit e248e6b20c462e3f42e4cb73ab4a9fe0d5eeabbf in avro's branch 
refs/heads/main from Marcos Schroh
[ https://gitbox.apache.org/repos/asf?p=avro.git;h=e248e6b20 ]

AVRO-3917: [Rust] take field aliases into account when calculating schema 
compatibilities (#2633)

* AVRO-3917: [Rust] take field aliases into account when calculating schema 
compatibilities

* AVRO-3917: Minor improvements

Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>

---------

Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>
Co-authored-by: Martin Tzvetanov Grigorov <[email protected]>

> [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
>            Priority: Minor
>              Labels: pull-request-available
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> 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)

Reply via email to