LuciferYang opened a new pull request, #13412:
URL: https://github.com/apache/gravitino/pull/13412

   ### What changes were proposed in this pull request?
   
   `ModelVersionEntity.hashCode` now combines an order-independent sum of 
element hashes for `aliases` with the scalar fields, matching exactly what 
`equals` compares. `uris` and `properties` are `Map`s whose hash is already 
order-independent and are left unchanged.
   
   ### Why are the changes needed?
   
   `equals` compares `aliases` order-independently via 
`CollectionUtils.isEqualCollection`, but `hashCode` hashed the `List` directly, 
so two equal model versions with different alias ordering hashed differently, 
breaking the `Object.hashCode` contract for any hash-based collection.
   
   Fix: #13411
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   Added `TestModelVersionEntity.testHashCodeConsistentWithBagEquality`, which 
pins that two model versions equal under unordered aliases share a hash code. 
It fails against the pre-fix code.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to