Skip to main content

java_string_hash_partition

Function java_string_hash_partition 

Source
pub fn java_string_hash_partition(
    units: &[u16],
    partition_count: i32,
) -> Option<i32>
Expand description

Java String.hashCode over UTF-16 code units, followed by Kafka’s Utils.abs(hash) % partition_count coordinator selection.

The host supplies str::encode_utf16() output so non-ASCII group ids use the same surrogate-pair semantics as the JVM. Java’s Integer.MIN_VALUE absolute-value corner maps to zero, matching Utils.abs.