scovich commented on code in PR #7943: URL: https://github.com/apache/arrow-rs/pull/7943#discussion_r2214214548
########## parquet-variant/src/variant/metadata.rs: ########## @@ -332,6 +334,30 @@ impl<'m> VariantMetadata<'m> { } } +// According to the spec, metadata dictionaries are not required to be in a specific order, +// to enable flexibility when constructing Variant values +// +// Instead of comparing the raw bytes of 2 variant metadata instances, this implementation +// checks whether the dictionary entries are equal -- regardless of their sorting order +impl<'m> PartialEq for VariantMetadata<'m> { + fn eq(&self, other: &Self) -> bool { + let is_equal = self.is_empty() == other.is_empty() + && self.is_fully_validated() == other.is_fully_validated() + && self.first_value_byte == other.first_value_byte + && self.validated == other.validated; + + let other_field_names: HashSet<&'m str> = HashSet::from_iter(other.iter()); + + for field_name in self.iter() { + if !other_field_names.contains(field_name) { + return false; Review Comment: This seems one-sided? Don't we need to prove the symmetric difference is empty? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org