Subgraph Composition: Fix Entity Ordering with different Idtype#5760
Closed
incrypto32 wants to merge 1 commit intozoran/subgraph-composition-spec-versionfrom
Closed
Subgraph Composition: Fix Entity Ordering with different Idtype#5760incrypto32 wants to merge 1 commit intozoran/subgraph-composition-spec-versionfrom
incrypto32 wants to merge 1 commit intozoran/subgraph-composition-spec-versionfrom
Conversation
zorancv
reviewed
Jan 9, 2025
| let other_str = String::from_utf8(other.id.clone()).map_err(IdCompareError::InvalidUtf8)?; | ||
| Ok(self_str.cmp(&other_str)) | ||
| } | ||
| IdType::Bytes => Ok(self.id.cmp(&other.id)), |
Contributor
There was a problem hiding this comment.
The same check could be used for the string too. We don't care what is the content of the ID, only if it's equal to the other one. And I would go so far to say that it holds for Int8 case too as we don't mind if the order is ascending or descending, we only need the cmp() to be able to detect equality and have a consistent ordering otherwise which is achieved with byte comparison. So I would keep the Ord a it is and only change the type of the id field in EntityDataExt.
zorancv
suggested changes
Jan 9, 2025
| } | ||
|
|
||
| #[test] | ||
| fn read_range_pool_created_test() { |
Contributor
There was a problem hiding this comment.
Very nice to add a test case!
0d72898 to
ad34735
Compare
zorancv
approved these changes
Jan 9, 2025
| fn compare_entity_data_ext(a: &EntityDataExt, b: &EntityDataExt) -> std::cmp::Ordering { | ||
| a.block_number | ||
| .cmp(&b.block_number) | ||
| .then_with(|| a.entity.cmp(&b.entity)) |
ad34735 to
748ff48
Compare
14671db to
640e7d1
Compare
06edc2b to
f38680e
Compare
097a772 to
d8bea9d
Compare
3d25869 to
6a28007
Compare
197b18d to
2a45671
Compare
e5d997b to
c8d8103
Compare
2a45671 to
e28ab16
Compare
c8d8103 to
a6b7647
Compare
a6b7647 to
9fa915b
Compare
e28ab16 to
4a290bf
Compare
c82c6cf to
432ba56
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.