LuciferYang opened a new pull request, #13422: URL: https://github.com/apache/gravitino/pull/13422
### What changes were proposed in this pull request? Adds an order-independent, null-safe `CollectionUtils.unorderedHashCode`, right next to `isEqualCollection`, and uses it from the five entities whose `equals` compares a collection with bag semantics: - `GroupEntity`, `UserEntity`: `roleNames`, `roleIds` (also folds in `namespace`, which `equals` already compares) - `ModelVersionEntity`: `aliases` - `RoleEntity`: `securableObjects` - `TableEntity`: `columns` (also drops a duplicated `distribution` argument) ### Why are the changes needed? Each entity's `equals` compares the collection field order-independently via `CollectionUtils.isEqualCollection`, but `hashCode` hashed the `List` directly, so two equal entities that differ only in element order hashed differently, breaking the `Object.hashCode` contract for any hash-based collection. Sharing one helper keeps `equals` and `hashCode` consistent, and the helper is null-safe on both the collection and its elements. Fix: #13421 ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Added `TestCollectionUtils` covering `unorderedHashCode` order-independence, bag-equality consistency, and null-collection and null-element handling. Added per-entity regression tests (`TestGroupEntity`, `TestUserEntity`, `TestModelVersionEntity`, `TestRoleEntity`, `TestEntity`) pinning that two entities equal under an unordered collection share a hash code. Each 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]
