@Override public int hashCode() { return value.hashCode(); } }
@Override public int hashCode() { return value.hashCode(); } }
@ScalarOperator(HASH_CODE) @SqlType(BIGINT) public static long hashCode(@SqlType(JSON) Slice value) { return value.hashCode(); }
@Override public int hashCode() { return value.hashCode(); } }
@Override public int hashCode() { return value.hashCode(); } }
@Override public int hashCode() { return value.hashCode(); } }
@Override public int hashCode() { return value.hashCode(); } }
@Override public int hashCode() { return value.hashCode(); } }
/** * Returns the hash code of this slice. The hash code is cached once calculated * and any future changes to the slice will not effect the hash code. */ @SuppressWarnings("NonFinalFieldReferencedInHashCode") @Override public int hashCode() { if (hash != 0) { return hash; } hash = hashCode(0, size); return hash; }
/** * Returns the hash code of this slice. The hash code is cached once calculated * and any future changes to the slice will not effect the hash code. */ @SuppressWarnings("NonFinalFieldReferencedInHashCode") @Override public int hashCode() { if (hash != 0) { return hash; } hash = hashCode(0, size); return hash; }
@ScalarOperator(HASH_CODE) @SqlType(BIGINT) public static long hashCode(@SqlType(JSON) Slice value) { return value.hashCode(); }
@ScalarOperator(HASH_CODE) @SqlType(BIGINT) public static long hashCode(@SqlType(JSON) Slice value) { return value.hashCode(); }
@ScalarOperator(HASH_CODE) @SqlType(BIGINT) public static long hashCode(@SqlType(JSON) Slice value) { return value.hashCode(); }
@ScalarOperator(HASH_CODE) @SqlType(StandardTypes.BIGINT) public static long hashCode(@SqlType(StandardTypes.VARBINARY) Slice value) { return value.hashCode(); } }
private static void assertSlicesEquals(Slice slice, Slice other) { int size = slice.length(); assertEquals(slice, other); assertTrue(slice.equals(0, size, other, 0, size)); assertEquals(slice.hashCode(), other.hashCode()); assertEquals(slice.hashCode(), other.hashCode(0, size)); assertEquals(slice.compareTo(other), 0); assertEquals(slice.compareTo(0, size, other, 0, size), 0); for (int i = 0; i < slice.length(); i++) { assertTrue(slice.equals(i, size - i, other, i, size - i)); assertEquals(slice.hashCode(i, size - i), other.hashCode(i, size - i)); assertEquals(slice.compareTo(i, size - i, other, i, size - i), 0); } for (int i = 0; i < slice.length(); i++) { assertTrue(slice.equals(0, size - i, other, 0, size - i)); assertEquals(slice.hashCode(0, size - i), other.hashCode(0, size - i)); assertEquals(slice.compareTo(0, size - i, other, 0, size - i), 0); } }
@LiteralParameters("x") @ScalarOperator(HASH_CODE) @SqlType(StandardTypes.BIGINT) public static long hashCode(@SqlType("varchar(x)") Slice value) { return value.hashCode(); } }
private static void assertSlicesEquals(Slice slice, Slice other) { int size = slice.length(); assertEquals(slice, other); assertTrue(slice.equals(0, size, other, 0, size)); assertEquals(slice.hashCode(), other.hashCode()); assertEquals(slice.hashCode(), other.hashCode(0, size)); assertEquals(slice.compareTo(other), 0); assertEquals(slice.compareTo(0, size, other, 0, size), 0); for (int i = 0; i < slice.length(); i++) { assertTrue(slice.equals(i, size - i, other, i, size - i)); assertEquals(slice.hashCode(i, size - i), other.hashCode(i, size - i)); assertEquals(slice.compareTo(i, size - i, other, i, size - i), 0); } for (int i = 0; i < slice.length(); i++) { assertTrue(slice.equals(0, size - i, other, 0, size - i)); assertEquals(slice.hashCode(0, size - i), other.hashCode(0, size - i)); assertEquals(slice.compareTo(0, size - i, other, 0, size - i), 0); } }
@Benchmark public long hash(BenchmarkData data, ByteCounter counter) { counter.add(data.getSlice().length()); return data.getSlice().hashCode(0, data.getSlice().length()); }
@Benchmark public long hash(BenchmarkData data, ByteCounter counter) { counter.add(data.getSlice().length()); return data.getSlice().hashCode(0, data.getSlice().length()); }
assertEquals(block.hash(position, offset, 3), expectedSliceValue.hashCode(offset, 3)); assertTrue(block.bytesEqual(position, offset, expectedSliceValue, offset, 3));