LuciferYang opened a new issue, #13415:
URL: https://github.com/apache/gravitino/issues/13415

   **What would you like to be improved?**
   
   `TableEntity.equals` compares `columns` with 
`CollectionUtils.isEqualCollection` (order-independent, bag semantics), but 
`hashCode` hashes the `List` directly, which is order-sensitive. Two tables 
that are equal under `equals` but differ only in column ordering get different 
hash codes, which violates the `Object.hashCode` contract and loses them in any 
`HashSet` or `HashMap`. The old `hashCode` argument list also included 
`distribution` twice.
   
   **How should we improve?**
   
   Combine an order-independent sum of element hashes for `columns` into 
`hashCode`, matching exactly the fields `equals` compares, and drop the 
duplicated `distribution` argument. `partitioning`, `sortOrders`, and `indexes` 
are compared with `Arrays.equals` (order-sensitive) on both sides, so their 
`Arrays.hashCode` stays as is.
   


-- 
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