waterWang opened a new pull request, #11725: URL: https://github.com/apache/seatunnel/pull/11725
### Problem `MultiTableSinkWriter.write` routes each row to a queue using: ```java index = Math.abs(object.hashCode()) % blockingQueues.size(); ``` `Math.abs(Integer.MIN_VALUE)` returns `Integer.MIN_VALUE` — still negative, because `-Integer.MIN_VALUE` is not representable as an `int`. When the queue count is not a power of two, the modulo result is negative and `blockingQueues.get(index)` throws `IndexOutOfBoundsException`. ### Root Cause `Math.abs(int)` overflows for `Integer.MIN_VALUE` (`0x80000000`), which is its own negation. This is a well-known Java integer overflow pitfall. ### Fix Replace `Math.abs(hashCode())` with `(hashCode() & Integer.MAX_VALUE)`, which maps `Integer.MIN_VALUE` to `0` and preserves all other values without overflow. This follows the same pattern already applied in the file source split enumerator (PR #2921) and used in 12 other places across the codebase. ### Affected Versions Any `multi_table_sink_replica` value that is not a power of two triggers the crash when a primary key hashes to `Integer.MIN_VALUE` (e.g. `INT` value `-2147483648`, `BIGINT` value `-9223372036854775808`, or any string with `hashCode() == Integer.MIN_VALUE`). Closes #11720 -- 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]
