-
Notifications
You must be signed in to change notification settings - Fork 999
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Subgraph Composition: Fix Entity Ordering with different Idtype #5760
base: zoran/subgraph-composition-rework-vid-wrap2
Are you sure you want to change the base?
Subgraph Composition: Fix Entity Ordering with different Idtype #5760
Conversation
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)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
.
@@ -406,3 +420,71 @@ fn read_immutable_only_range_test() { | |||
assert_eq!(e.len(), 4); | |||
}) | |||
} | |||
|
|||
#[test] | |||
fn read_range_pool_created_test() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice to add a test case!
0d72898
to
ad34735
Compare
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)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
elegant!
ad34735
to
748ff48
Compare
14671db
to
640e7d1
Compare
No description provided.