Skip to content
Permalink
Browse files
Use non deprecated version of Hashing.murmur3_32() (#199)
  • Loading branch information
DomGarguilo committed Mar 24, 2022
1 parent da4a434 commit 62a9b067d95721a55c3404bb1834d1acddde78ed
Showing 2 changed files with 8 additions and 7 deletions.
@@ -83,12 +83,13 @@ private String toHex(long l1, long l2, long l3) {
}

private String toHexWithHash(long l1, long l2) {
int hc = Hashing.murmur3_32().newHasher().putLong(l1).putLong(l2).hash().asInt();
int hc = Hashing.murmur3_32_fixed().newHasher().putLong(l1).putLong(l2).hash().asInt();
return toHex(hc) + ":" + toHex(l1) + ":" + toHex(l2);
}

private String toHexWithHash(long l1, long l2, long l3) {
int hc = Hashing.murmur3_32().newHasher().putLong(l1).putLong(l2).putLong(l3).hash().asInt();
int hc = Hashing.murmur3_32_fixed().newHasher().putLong(l1).putLong(l2).putLong(l3).hash()
.asInt();
return toHex(hc) + ":" + toHex(l1) + ":" + toHex(l2) + ":" + toHex(l3);
}

@@ -392,12 +392,12 @@ private static void writeData(Environment env, String tableName, int numRows, in
}

private static Mutation genRow(int row, int numCols) {
String r = String.format("%08x", Math.abs(Hashing.murmur3_32().hashInt(row).asInt()));
String r = String.format("%08x", Math.abs(Hashing.murmur3_32_fixed().hashInt(row).asInt()));
Mutation m = new Mutation(r);

for (int col = 0; col < numCols; col++) {
String c = String.format("%04x",
Math.abs(Hashing.murmur3_32().hashInt(col).asInt() & 0xffff));
Math.abs(Hashing.murmur3_32_fixed().hashInt(col).asInt() & 0xffff));
m.put("data", c, "1");
}
return m;
@@ -409,7 +409,7 @@ private static void writeLgData(Environment env, String tableName, int numRows)
BatchWriter bw = env.getClient().createBatchWriter(tableName, new BatchWriterConfig());
numRows = numRows * 10;
for (int row = 0; row < numRows; row++) {
String r = String.format("%08x", Math.abs(Hashing.murmur3_32().hashInt(row).asInt()));
String r = String.format("%08x", Math.abs(Hashing.murmur3_32_fixed().hashInt(row).asInt()));
Mutation m = new Mutation(r);
m.put("ntfy", "absfasf3", "");
bw.addMutation(m);
@@ -419,15 +419,15 @@ private static void writeLgData(Environment env, String tableName, int numRows)

private static String randRow(Random rand, int numRows) {
int row = rand.nextInt(numRows);
return String.format("%08x", Math.abs(Hashing.murmur3_32().hashInt(row).asInt()));
return String.format("%08x", Math.abs(Hashing.murmur3_32_fixed().hashInt(row).asInt()));
}

private static Collection<String> randCols(Random rand, int num, int numCols) {
HashSet<String> cols = new HashSet<>();
while (cols.size() < num) {
int col = rand.nextInt(numCols);
String c = String.format("%04x",
Math.abs(Hashing.murmur3_32().hashInt(col).asInt() & 0xffff));
Math.abs(Hashing.murmur3_32_fixed().hashInt(col).asInt() & 0xffff));
cols.add(c);
}
return cols;

0 comments on commit 62a9b06

Please sign in to comment.