martin-g commented on code in PR #2774:
URL: https://github.com/apache/avro/pull/2774#discussion_r1508695642


##########
lang/rust/avro/src/schema_compatibility.rs:
##########
@@ -394,70 +384,21 @@ impl SchemaCompatibility {
                                 .then_some(())
                                 .ok_or(CompatibilityError::FixedMismatch);
                         }
-
-                        return Err(CompatibilityError::TypeExpected {
-                            schema_type: String::from("writers_schema"),
-                            expected_type: vec![r_type],
-                        });
-                    }
-                }
-                SchemaKind::Enum => {
-                    if let Schema::Enum(EnumSchema { name: w_name, .. }) = 
writers_schema {
-                        if let Schema::Enum(EnumSchema { name: r_name, .. }) = 
readers_schema {
-                            if w_name.name == r_name.name {
-                                return Ok(());
-                            }
-
-                            return Err(CompatibilityError::NameMismatch {
-                                writer_name: w_name.name.clone(),
-                                reader_name: r_name.name.clone(),
-                            });
-                        }
-
-                        return Err(CompatibilityError::TypeExpected {
-                            schema_type: String::from("readers_schema"),
-                            expected_type: vec![r_type],
-                        });
                     }
-
-                    return Err(CompatibilityError::TypeExpected {
-                        schema_type: String::from("writers_schema"),
-                        expected_type: vec![r_type],
-                    });
                 }
                 SchemaKind::Map => {
                     if let Schema::Map(w_m) = writers_schema {
                         if let Schema::Map(r_m) = readers_schema {
                             return 
SchemaCompatibility::match_schemas(&w_m.types, &r_m.types);
                         }
-
-                        return Err(CompatibilityError::TypeExpected {
-                            schema_type: String::from("readers_schema"),
-                            expected_type: vec![r_type],
-                        });
                     }
-
-                    return Err(CompatibilityError::TypeExpected {

Review Comment:
   Why this is not reachable ?
   Reading the code I think it should reach this code when the reader schema is 
Map and the writer is something else.



##########
lang/rust/avro/src/schema_compatibility.rs:
##########
@@ -480,14 +421,7 @@ impl SchemaCompatibility {
                     );
                 }
                 SchemaKind::Duration => {
-                    if let Schema::Duration = writers_schema {

Review Comment:
   Why this is not needed ?



##########
lang/rust/avro/src/schema_compatibility.rs:
##########
@@ -480,14 +421,7 @@ impl SchemaCompatibility {
                     );
                 }
                 SchemaKind::Duration => {
-                    if let Schema::Duration = writers_schema {
-                        return Ok(());
-                    }
-
-                    return Err(CompatibilityError::TypeExpected {
-                        schema_type: String::from("writers_schema"),
-                        expected_type: vec![r_type, SchemaKind::Fixed],

Review Comment:
   `SchemaKind::Fixed` seems to have been wrong...



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to