LuciferYang opened a new pull request, #12351:
URL: https://github.com/apache/gluten/pull/12351
## What changes are proposed in this pull request?
`ConsistentHash.Partition.getPartitionKey()` built its hash input from the
node object directly:
```java
return String.format("%s:%d", node, index);
```
`%s` resolves to `node.toString()`, so `Node.key()` was never used. This PR
places virtual nodes on the ring by `node.key()`, adds a fail-fast check for a
null key, and documents the `key()` contract.
`Node.key()` exists so the ring is keyed on a stable, logical id. Using
`toString()` instead left `key()` as dead code, and the ring only happened to
be correct because the one implementation (`ExecutorNode`) returns the same
value from both methods. A future `Node` that implements only `key()` would be
placed by `Object.toString()` (the identity hash), producing a different layout
on every run and across JVMs — i.e. not consistent hashing at all. No
user-facing change.
Fixes #12350.
## How was this patch tested?
Added two unit tests in `ConsistentHashTest`: one asserts partitions are
hashed by `key()` and never `toString()`, the other that a null key is
rejected. The existing cases still pass.
## Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 4.8)
--
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]