本文整理了Java中io.airlift.slice.Slice.setLong()
方法的一些代码示例,展示了Slice.setLong()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Slice.setLong()
方法的具体详情如下:
包路径:io.airlift.slice.Slice
类名称:Slice
方法名:setLong
[英]Sets the specified 64-bit long integer at the specified absolute index in this buffer.
[中]在此缓冲区中指定的绝对索引处设置指定的64位长整数。
代码示例来源:origin: prestodb/presto
public Slice getSync()
{
Slice sync = Slices.allocate(SIZE_OF_LONG + SIZE_OF_LONG);
sync.setLong(0, syncFirst);
sync.setLong(SIZE_OF_LONG, syncSecond);
return sync;
}
代码示例来源:origin: prestodb/presto
@Override
public void writeLong(long value)
{
ensureWritableBytes(SIZE_OF_LONG);
slice.setLong(bufferPosition, value);
bufferPosition += SIZE_OF_LONG;
}
代码示例来源:origin: prestodb/presto
@Override
public void writeLong(long value)
{
ensureWritableBytes(SIZE_OF_LONG);
slice.setLong(bufferPosition, value);
bufferPosition += SIZE_OF_LONG;
}
代码示例来源:origin: prestodb/presto
@Override
public void writeLong(long value)
{
ensureWritableBytes(SIZE_OF_LONG);
slice.setLong(bufferPosition, value);
bufferPosition += SIZE_OF_LONG;
}
代码示例来源:origin: prestodb/presto
@Override
public void writeLong(long value)
{
ensureWritableBytes(SIZE_OF_LONG);
slice.setLong(bufferPosition, value);
bufferPosition += SIZE_OF_LONG;
}
代码示例来源:origin: prestodb/presto
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);
}
}
}
代码示例来源:origin: prestodb/presto
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();
}
代码示例来源:origin: prestodb/presto
@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;
}
代码示例来源:origin: embulk/embulk
private void writeLong(int columnIndex, long value) {
bufferSlice.setLong(getOffset(columnIndex), value);
clearNull(columnIndex);
}
代码示例来源:origin: prestodb/presto
@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;
}
代码示例来源:origin: prestodb/presto
@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;
}
代码示例来源:origin: prestodb/presto
@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;
}
代码示例来源:origin: prestodb/presto
slice.setInt(HYPERPARAMETER_LENGTH_OFFSET, hyperparameters.length);
slice.setBytes(HYPERPARAMETERS_OFFSET, hyperparameters);
slice.setLong(dataLengthOffset, data.length);
slice.setBytes(dataOffset, data);
代码示例来源:origin: embulk/embulk
private void writeTimestamp(int columnIndex, Timestamp value) {
int offset = getOffset(columnIndex);
bufferSlice.setLong(offset, value.getEpochSecond());
bufferSlice.setInt(offset + 8, value.getNano());
clearNull(columnIndex);
}
代码示例来源:origin: airlift/slice
@Override
public void writeLong(long value)
{
slice.setLong(size, value);
size += SIZE_OF_LONG;
}
代码示例来源:origin: airlift/slice
@Override
public void writeLong(long value)
{
slice = Slices.ensureSize(slice, size + SIZE_OF_LONG);
slice.setLong(size, value);
size += SIZE_OF_LONG;
}
代码示例来源:origin: io.airlift/slice
@Override
public void writeLong(long value)
{
slice = Slices.ensureSize(slice, size + SIZE_OF_LONG);
slice.setLong(size, value);
size += SIZE_OF_LONG;
}
代码示例来源:origin: airlift/slice
@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);
}
代码示例来源:origin: io.airlift/slice
@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);
}
代码示例来源:origin: io.airlift/slice
@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);
}
内容来源于网络,如有侵权,请联系作者删除!