You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@avro.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2024/03/01 12:49:00 UTC
[jira] [Commented] (AVRO-3950) [rust] Some code when checking schema compatibility is never reached
[ https://issues.apache.org/jira/browse/AVRO-3950?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17822540#comment-17822540 ]
ASF subversion and git services commented on AVRO-3950:
-------------------------------------------------------
Commit df41f67ed511ed394fe6e9881290fc7e9e3935a8 in avro's branch refs/heads/main from Marcos Schroh
[ https://gitbox.apache.org/repos/asf?p=avro.git;h=df41f67ed ]
AVRO-3950: [Rust] remove code that it is never called on schema_compatibility match_schemas function (#2774)
> [rust] Some code when checking schema compatibility is never reached
> --------------------------------------------------------------------
>
> Key: AVRO-3950
> URL: https://issues.apache.org/jira/browse/AVRO-3950
> Project: Apache Avro
> Issue Type: Improvement
> Reporter: Marcos Schroh
> Priority: Minor
> Labels: pull-request-available
> Time Spent: 1.5h
> Remaining Estimate: 0h
>
> When checking schema compatibility between schemas some code blocks are never reached. For example, [these lines |https://github.com/apache/avro/blob/main/lang/rust/avro/src/schema_compatibility.rs#L365-L374] are never reached because writer and readers schemas are for sure the same type (record) which is [previously compared|https://github.com/apache/avro/blob/main/lang/rust/avro/src/schema_compatibility.rs#L346].
> This issue leads to unnecessary *if let* blocks which can be suppressed and `Errors` that are never reached. For example the following code could be removed because it is know before hand that the schema is Record which it has a name and only one error can be retrieved.
> {code}
> let Schema::Record(RecordSchema { name: w_name, .. }) = writers_schema { ... }
> {code}
> *Solution*: Refactor the code and add more unittest to match_schemas function to clean up the unreachable code
--
This message was sent by Atlassian Jira
(v8.20.10#820010)