[ 
https://issues.apache.org/jira/browse/AVRO-3939?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17818721#comment-17818721
 ] 

ASF subversion and git services commented on AVRO-3939:
-------------------------------------------------------

Commit e03800472eaad3d9bfa3292e518264ee0210d991 in avro's branch 
refs/heads/dependabot/cargo/lang/rust/env_logger-0.11.2 from Martin Grigorov
[ https://gitbox.apache.org/repos/asf?p=avro.git;h=e03800472 ]

AVRO-3939: [Rust] Make it possible to use custom schema equality comparators 
(#2739)

* AVRO-3939: [Rust] Make it possible to use custom schema comparators

Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>

* AVRO-3939: Temporarily use StructFieldComparator as default

Implement compare_fields()

Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>

* AVRO-3939: Fix formatting and clippy issues

Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>

* AVRO-3939: Rename the trait and its impls from Comparator to Eq

Add unit tests for the primitives

Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>

* AVRO-3939: Add support for comparing the custom attributes to
StructFieldEq

Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>

* AVRO-3939: Add more unit tests

Fix clippy error with Rust nightly, e.g.:

```
error: the item `TryFrom` is imported redundantly
  --> avro/src/types.rs:34:5
   |
34 |     convert::TryFrom,
   |     ^^^^^^^^^^^^^^^^
  --> 
/rustc/2bf78d12d33ae02d10010309a0d85dd04e7cff72/library/std/src/prelude/mod.rs:129:13
   |
   = note: the item `TryFrom` is already defined here

error: could not compile `apache-avro` (lib) due to 9 previous errors
```

Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>

* AVRo-3939: Add more unit tests

fix more Rust nightly clippy errors in tests

Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>

* AVRO-3939: More unit tests and better logging

Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>

* AVRO-3939: Fix rust nightly clippy error

```
error: the item `RecordField` is imported redundantly
    --> avro/src/types.rs:1153:18
     |
1150 |     use super::*;
     |         -------- the item `RecordField` is already imported here
...
1153 |         schema::{RecordField, RecordFieldOrder},
     |                  ^^^^^^^^^^^
     |
     = note: `-D unused-imports` implied by `-D warnings`
     = help: to override `-D warnings` add `#[allow(unused_imports)]`
```

Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>

* AVRO-3939: Improve TestLogger's assert_logged to assert against all logged 
messages

Not just against the last logged message

Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>

* Fix rust nightly clippy error

```
error: the item `FromIterator` is imported redundantly
  --> avro/benches/serde_json.rs:20:33
   |
20 | use std::{collections::HashMap, iter::FromIterator};
   |                                 ^^^^^^^^^^^^^^^^^^
  --> 
/rustc/2bf78d12d33ae02d10010309a0d85dd04e7cff72/library/std/src/prelude/mod.rs:129:13
   |
   = note: the item `FromIterator` is already defined here
   |
   = note: `-D unused-imports` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(unused_imports)]`

error: could not compile `apache-avro` (bench "serde_json") due to 1 previous 
error
warning: build failed, waiting for other jobs to finish...
Error: Process completed with exit code 101.
```

Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>

* AVRO-3939: More test assertions and better logging

Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>

* AVRO-3939: Use StructFieldEq impl by default

It is much faster than SpecificationEq which serializes the schemas to
JSON and then compares them as strings

Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>

* AVro-3939: Format the code

Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>

---------

Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>

> [Rust] Make it possible to use custom schema comparators
> --------------------------------------------------------
>
>                 Key: AVRO-3939
>                 URL: https://issues.apache.org/jira/browse/AVRO-3939
>             Project: Apache Avro
>          Issue Type: Improvement
>          Components: rust
>            Reporter: Martin Tzvetanov Grigorov
>            Assignee: Martin Tzvetanov Grigorov
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.12.0, 1.11.4
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> Currently comparing two schemas for equality compares their canonical forms - 
> https://github.com/apache/avro/blob/main/lang/rust/avro/src/schema.rs#L160.
> I.e. the schemas are first serialized to their canonical forms and then 
> compared as strings.
> The main issue here is the performance! The serialization takes it time!
> Comparing the schemas field by field (following the same rules as the 
> canonical forms - 
> https://avro.apache.org/docs/1.11.1/specification/#parsing-canonical-form-for-schemas)
>  will return as soon as a field is different. For example: record schema with 
> a different name will return false without comparing all the fields.
> Another request by users is to compare the schemas even with fields which are 
> not part of the canonical form, e.g. the custom attributes - 
> https://github.com/apache/avro/pull/2708#discussion_r1467183416



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

Reply via email to