findepi commented on code in PR #16781: URL: https://github.com/apache/datafusion/pull/16781#discussion_r2207256256
########## datafusion/core/tests/user_defined/user_defined_aggregates.rs: ########## @@ -957,6 +957,33 @@ impl AggregateUDFImpl for MetadataBasedAggregateUdf { curr_sum: 0, })) } + + fn equals(&self, other: &dyn AggregateUDFImpl) -> bool { + let Some(other) = other.as_any().downcast_ref::<Self>() else { + return false; + }; + let Self { + name, + signature, + metadata, + } = self; + name == &other.name + && signature == &other.signature + && metadata == &other.metadata + } + + fn hash_value(&self) -> u64 { + let Self { + name, + signature, + metadata: _, // unhashable + } = self; + let mut hasher = DefaultHasher::new(); + std::any::type_name::<Self>().hash(&mut hasher); + name.hash(&mut hasher); + signature.hash(&mut hasher); + hasher.finish() Review Comment: It does not. It's valid for a hash function to omit some fields. In fact, this is a totally _correct_ hash implementation (just not very practical): ```rust fn hash_value(&self) -> u64 { 0 } ``` -- 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...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org