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

   ### What changes were proposed in this pull request?
   
   `TableEntity.hashCode` now combines an order-independent sum of element 
hashes for `columns` with the scalar fields, matching exactly what `equals` 
compares, and drops the accidentally duplicated `distribution` argument. 
`partitioning`, `sortOrders`, and `indexes` are compared with `Arrays.equals` 
on both sides, so their `Arrays.hashCode` is left unchanged.
   
   ### Why are the changes needed?
   
   `equals` compares `columns` order-independently via 
`CollectionUtils.isEqualCollection`, but `hashCode` hashed the `List` directly, 
so two equal tables with different column ordering hashed differently, breaking 
the `Object.hashCode` contract for any hash-based collection.
   
   Fix: #13415
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   Added `TestEntity.testTableEntityHashCodeConsistentWithBagEquality`, which 
pins that two tables equal under unordered columns 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