@Override public void writeLong(long value) { ensureWritableBytes(SIZE_OF_LONG); slice.setLong(bufferPosition, value); bufferPosition += SIZE_OF_LONG; }
@Override public void writeLong(long value) { ensureWritableBytes(SIZE_OF_LONG); slice.setLong(bufferPosition, value); bufferPosition += SIZE_OF_LONG; }
@Override public void writeLong(long value) { ensureWritableBytes(SIZE_OF_LONG); slice.setLong(bufferPosition, value); bufferPosition += SIZE_OF_LONG; }
@Override public void writeLong(long value) { ensureWritableBytes(SIZE_OF_LONG); slice.setLong(bufferPosition, value); bufferPosition += SIZE_OF_LONG; }
public void addPage(Page page) { requireNonNull(page, "page is null"); checkArgument(page.getChannelCount() == columnHashes.size(), "invalid page"); totalRowCount += page.getPositionCount(); for (int channel = 0; channel < columnHashes.size(); channel++) { Type type = types.get(channel); Block block = page.getBlock(channel); XxHash64 xxHash64 = columnHashes.get(channel); for (int position = 0; position < block.getPositionCount(); position++) { long hash = hashPositionSkipNullMapKeys(type, block, position); longSlice.setLong(0, hash); xxHash64.update(longBuffer); } } }
public void addPage(Page page) { requireNonNull(page, "page is null"); checkArgument(page.getChannelCount() == columnHashes.size(), "invalid page"); for (int channel = 0; channel < columnHashes.size(); channel++) { Type type = types.get(channel); Block block = page.getBlock(channel); XxHash64 xxHash64 = columnHashes.get(channel); for (int position = 0; position < block.getPositionCount(); position++) { long hash = hashPositionSkipNullMapKeys(type, block, position); longSlice.setLong(0, hash); xxHash64.update(longBuffer); } } totalRowCount += page.getPositionCount(); }
@Description("encode value as a big endian varbinary according to IEEE 754 double-precision floating-point format") @ScalarFunction("to_ieee754_64") @SqlType(StandardTypes.VARBINARY) public static Slice toIEEE754Binary64(@SqlType(StandardTypes.DOUBLE) double value) { Slice slice = Slices.allocate(Double.BYTES); slice.setLong(0, Long.reverseBytes(Double.doubleToLongBits(value))); return slice; }
private void writeLong(int columnIndex, long value) { bufferSlice.setLong(getOffset(columnIndex), value); clearNull(columnIndex); }
@Description("encode value as a 64-bit 2's complement big endian varbinary") @ScalarFunction("to_big_endian_64") @SqlType(StandardTypes.VARBINARY) public static Slice toBigEndian64(@SqlType(StandardTypes.BIGINT) long value) { Slice slice = Slices.allocate(Long.BYTES); slice.setLong(0, Long.reverseBytes(value)); return slice; }
@Description("compute xxhash64 hash") @ScalarFunction @SqlType(StandardTypes.VARBINARY) public static Slice xxhash64(@SqlType(StandardTypes.VARBINARY) Slice slice) { Slice hash = Slices.allocate(Long.BYTES); hash.setLong(0, Long.reverseBytes(XxHash64.hash(slice))); return hash; }
@Description("compute SpookyHashV2 64-bit hash") @ScalarFunction @SqlType(StandardTypes.VARBINARY) public static Slice spookyHashV2_64(@SqlType(StandardTypes.VARBINARY) Slice slice) { Slice hash = Slices.allocate(Long.BYTES); hash.setLong(0, Long.reverseBytes(SpookyHashV2.hash64(slice, 0, slice.length(), 0))); return hash; }
slice.setInt(HYPERPARAMETER_LENGTH_OFFSET, hyperparameters.length); slice.setBytes(HYPERPARAMETERS_OFFSET, hyperparameters); slice.setLong(dataLengthOffset, data.length); slice.setBytes(dataOffset, data);
private void writeTimestamp(int columnIndex, Timestamp value) { int offset = getOffset(columnIndex); bufferSlice.setLong(offset, value.getEpochSecond()); bufferSlice.setInt(offset + 8, value.getNano()); clearNull(columnIndex); }
@Override public void writeLong(long value) { slice.setLong(size, value); size += SIZE_OF_LONG; }
@Override public void writeLong(long value) { slice = Slices.ensureSize(slice, size + SIZE_OF_LONG); slice.setLong(size, value); size += SIZE_OF_LONG; }
@Override public void writeLong(long value) { slice = Slices.ensureSize(slice, size + SIZE_OF_LONG); slice.setLong(size, value); size += SIZE_OF_LONG; }
@Test(invocationCount = 100) public void testSingleLong() throws Exception { long value = ThreadLocalRandom.current().nextLong(); Slice slice = Slices.allocate(8); slice.setLong(0, value); long expected = Murmur3Hash128.hash64(slice); long actual = Murmur3Hash128.hash64(value); assertEquals(actual, expected); }
@Test(invocationCount = 100) public void testSingleLong() throws Exception { long value = ThreadLocalRandom.current().nextLong(); Slice slice = Slices.allocate(8); slice.setLong(0, value); long expected = Murmur3Hash128.hash64(slice); long actual = Murmur3Hash128.hash64(value); assertEquals(actual, expected); }
@Test(invocationCount = 100) public void testSingleLong() throws Exception { long value = ThreadLocalRandom.current().nextLong(); Slice slice = Slices.allocate(8); slice.setLong(0, value); int expected = Murmur3Hash32.hash(slice); int actual = Murmur3Hash32.hash(value); assertEquals(actual, expected); }