[
https://issues.apache.org/jira/browse/AVRO-3950?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17821938#comment-17821938
]
ASF subversion and git services commented on AVRO-3950:
-------------------------------------------------------
Commit fa10f24669d64d5aa84362104bcb71b03f5ff847 in avro's branch
refs/heads/main from Marcos Schroh
[ https://gitbox.apache.org/repos/asf?p=avro.git;h=fa10f2466 ]
AVRO-3950: [Rust] tests added for match_schemas in schema_compatibility (#2773)
* AVRO-3950: [Rust] tests added for match_schemas in schema_compatibility
* AVRO-3950: [Rust] Do not add all features of rstest
Improve test method names to include the ticket number
Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>
---------
Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>
Co-authored-by: Marcos Schroh <[email protected]>
Co-authored-by: Martin Tzvetanov Grigorov <[email protected]>
> [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: 0.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)