[
https://issues.apache.org/jira/browse/AVRO-3898?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17782121#comment-17782121
]
ASF subversion and git services commented on AVRO-3898:
-------------------------------------------------------
Commit 72714c55a698df6cccba9321a76ff2e678fbfbf1 in avro's branch
refs/heads/avro-3898-compatibility-with-namespace from Martin Tzvetanov Grigorov
[ https://gitbox.apache.org/repos/asf?p=avro.git;h=72714c55a ]
AVRO-3898: [Rust] Schema compatibility should not check namespace
According to the spec
(https://avro.apache.org/docs/1.11.1/specification/#schema-resolution)
named schemas must check only the unqualified names:
```
both schemas are records with the same (unqualified) name
```
Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>
> [rust] compatibility fails with different namespaces
> ----------------------------------------------------
>
> Key: AVRO-3898
> URL: https://issues.apache.org/jira/browse/AVRO-3898
> Project: Apache Avro
> Issue Type: Bug
> Components: rust
> Affects Versions: 1.11.3
> Reporter: Santiago Fraire Willemoes
> Priority: Minor
> Labels: rust
>
> *Current behavior*
> SchemaCompatibility does not work properly when `namespace` is present.
> The following schemas are `FORWARD` compatible.
> {code}
> use avro_rs::{Schema, schema_compatibility::SchemaCompatibility};
> let schema_1 = Schema::parse_str(r#"{
> "type": "record",
> "name": "Statistics",
> "fields": [
> { "name": "succes", "type": "int" },
> { "name": "fail", "type": "int" },
> { "name": "time", "type": "string" },
> { "name": "max", "type": "int", "default": 0 }
> ]
> }#").unwrap();
> let schema_2 = Schema::parse_str(r#"{
> "type": "record",
> "name": "Statistics",
> "fields": [
> { "name": "succes", "type": "int" },
> { "name": "fail", "type": "int" },
> { "name": "time", "type": "string" },
> { "name": "average", "type": "int"}
> ]
> }#").unwrap();
> {code}
> When using `SchemaCompatibility::can_read(...)` the result is `true`:
> {code}
> assert_eq!(true, SchemaCompatibility::can_read(&schema_1, &schema_2););
> {code}
> *However*, when the `namespace` is added then the result is `false`
> {code}
> let schema_3 = Schema::parse_str(r#"{
> "type": "record",
> "name": "Statistics",
> "namespace": "my.namespace"
> "fields": [
> { "name": "succes", "type": "int" },
> { "name": "fail", "type": "int" },
> { "name": "time", "type": "string" },
> { "name": "max", "type": "int", "default": 0 }
> ]
> }#").unwrap();
> assert_eq!(false, SchemaCompatibility::can_read(&schema_3, &schema_2););
> {code}
> *Desired behavior*
> Namespace should not affect compatibility
> *Notes*
> - My team is going to provide a PR soon to fix it
--
This message was sent by Atlassian Jira
(v8.20.10#820010)