我有以下字符串作为键。从下面的编码中,我看到所有的键都去了同一个减速器,尽管有很多减速器。最后,相同的减速器过载。我想,每个键(String),去一个不同的reducer。请帮我解决这个问题。谢谢!
String a = "71 1 2";
String b = "72 1 1";
String c = "70 1 3";
int hash_a = a.hashCode();
int hash_b = b.hashCode();
int hash_c = c.hashCode();
int part_a = hash_a % 10;
int part_b = hash_b % 10;
int part_c = hash_c % 10;
System.out.println("hash a: "+hash_a+" part_a: "+part_a);
System.out.println("hash b: "+hash_b+" part_b: "+part_b);
System.out.println("hash c: "+hash_c+" part_c: "+part_c);
Output:
hash a: 1620857277 part_a: 7
hash b: 1621780797 part_b: 7
hash c: 1619933757 part_c: 7