[ 
https://issues.apache.org/jira/browse/AVRO-3622?focusedWorklogId=804800&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-804800
 ]

ASF GitHub Bot logged work on AVRO-3622:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 30/Aug/22 11:53
            Start Date: 30/Aug/22 11:53
    Worklog Time Spent: 10m 
      Work Description: jjaakola-aiven commented on code in PR #1843:
URL: https://github.com/apache/avro/pull/1843#discussion_r958380963


##########
lang/py/avro/test/test_compatibility.py:
##########
@@ -659,6 +688,7 @@ def test_schema_compatibility(self):
                 ENUM_ABC_FIELD_DEFAULT_B_ENUM_DEFAULT_A_RECORD,
             ),
             (NS_RECORD1, NS_RECORD2),
+            (WITHOUT_NAMESPACE_RECORD, WITH_NAMESPACE_RECORD),

Review Comment:
   From the specification, 
https://avro.apache.org/docs/1.11.1/specification/_print/#schema-resolution
   ```
   * It is an error if the two schemas do not match. To match, one of the 
following must hold:
     ...
     * both schemas are records with the same (unqualified) name
     ...
   ```
   I am assuming this holds for compatibility.
   
   This change also aligns Python lib behavior with the Java implementation.
   The compatibility of names is handled on this line in Python lib: 
https://github.com/apache/avro/blob/master/lang/py/avro/compatibility.py#L378
   In Java lib it is here: 
https://github.com/apache/avro/blob/master/lang/java/avro/src/main/java/org/apache/avro/SchemaCompatibility.java#L97
   
   It could be error in the specification and therefore in the implementation 
that namespace is not relevant.





Issue Time Tracking
-------------------

    Worklog Id:     (was: 804800)
    Time Spent: 1h  (was: 50m)

> Python compatibility check fails if record with and without namespace are 
> compared
> ----------------------------------------------------------------------------------
>
>                 Key: AVRO-3622
>                 URL: https://issues.apache.org/jira/browse/AVRO-3622
>             Project: Apache Avro
>          Issue Type: Bug
>          Components: python
>    Affects Versions: 1.11.1
>            Reporter: Jarkko Jaakola
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> Avro spec:
> {noformat}
>  To match, one of the following must hold:
> ...
>   * both schemas are records with the same (unqualified) name{noformat}
> Following records are compatible. The `ReaderWriterCompatibilityChecker` 
> reports name mismatch and an incompatibility. Similar test case with Java 
> implementation passes.
> {code:java}
> WITHOUT_NAMESPACE_RECORD = parse(
>     json.dumps(
>         {
>             "type": SchemaType.RECORD,
>             "name": "Record1",
>             "fields": [
>                 {
>                     "name": "f1",
>                     "type": "int",
>                 }
>             ],
>         },
>     )
> )
> WITH_NAMESPACE_RECORD = parse(
>     json.dumps(
>         {
>             "type": SchemaType.RECORD,
>             "name": "ns.Record1",
>             "fields": [
>                 {
>                     "name": "f1",
>                     "type": "int",
>                 }
>             ],
>         },
>     )
> )
>  
> {code}



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

Reply via email to