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

   ### Describe the bug
   
   `ConsistentHash` is meant to place each virtual node on the ring using the 
node's logical `key()`. But `Partition.getPartitionKey()` builds the hash input 
straight from the node object:
   
   ```java
   return String.format("%s:%d", node, index);
   ```
   
   `%s` calls `node.toString()`, not `node.key()`. So `Node.key()` is never 
actually used — it's effectively dead code.
   
   This works today only by coincidence: the one implementation, 
`ExecutorNode`, overrides both `key()` and `toString()` to return the same 
string. Any future `Node` that implements just the contractual `key()` would 
have its ring built from `Object.toString()` (the identity hash), so the layout 
would differ on every run and across JVMs — which defeats the purpose of 
consistent hashing.
   
   ### How to reproduce
   
   Add a `Node` that overrides `key()` but not `toString()`, then build the 
ring. The partitions are placed by the identity-based `toString()` instead of 
`key()`.
   
   ### Expected behavior
   
   Partitions are placed on the ring by `Node.key()`, so the distribution is 
stable and reproducible across runs and JVMs.
   


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to