zhang-arvin opened a new pull request, #11859: URL: https://github.com/apache/seatunnel/pull/11859
## Purpose Fix IndexOutOfBoundsException in multi-table sink when primary key hashCode() returns Integer.MIN_VALUE. ## Root Cause `MultiTableSinkWriter.write()` uses `Math.abs(object.hashCode()) % blockingQueues.size()` for hash-based routing. When `hashCode()` returns `Integer.MIN_VALUE`, `Math.abs(Integer.MIN_VALUE)` overflows and returns `Integer.MIN_VALUE` (still negative), causing `ArrayIndexOutOfBoundsException` when `blockingQueues.size()` is not a power of two. ## Fix Replace `Math.abs(object.hashCode())` with `(object.hashCode() & Integer.MAX_VALUE)`, following the same pattern already used in 12 other places across the codebase (Paimon, Kafka, DynamoDB, HBase, Fluss, Typesense, TiDB CDC, MongoDB, Iceberg, JDBC, Easysearch, Hazelcast). ## Changes - `seatunnel-api/src/main/java/.../MultiTableSinkWriter.java`: Replace `Math.abs()` with `& Integer.MAX_VALUE` in hash routing - `seatunnel-api/src/test/java/.../MultiTableSinkWriterTest.java`: Add regression test with Integer.MIN_VALUE primary key and queueSize=3 ## Verification - All 27 MultiTableSinkWriterTest tests pass - Spotless formatting applied - 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]
