本文整理了Java中com.facebook.presto.spi.block.Block.getRegionSizeInBytes()
方法的一些代码示例,展示了Block.getRegionSizeInBytes()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Block.getRegionSizeInBytes()
方法的具体详情如下:
包路径:com.facebook.presto.spi.block.Block
类名称:Block
方法名:getRegionSizeInBytes
[英]Returns the size of block.getRegion(position, length). The method can be expensive. Do not use it outside an implementation of Block.
[中]返回块的大小。getRegion(位置、长度)。这种方法可能很昂贵。不要在块的实现之外使用它。
代码示例来源:origin: prestodb/presto
private void calculateSize()
{
int valueStart = offsets[arrayOffset];
int valueEnd = offsets[arrayOffset + positionCount];
sizeInBytes = values.getRegionSizeInBytes(valueStart, valueEnd - valueStart) + ((Integer.BYTES + Byte.BYTES) * (long) this.positionCount);
}
代码示例来源:origin: prestodb/presto
private void calculateSize()
{
int startFieldBlockOffset = fieldBlockOffsets[startOffset];
int endFieldBlockOffset = fieldBlockOffsets[startOffset + positionCount];
int fieldBlockLength = endFieldBlockOffset - startFieldBlockOffset;
long sizeInBytes = (Integer.BYTES + Byte.BYTES) * (long) positionCount;
for (int i = 0; i < numFields; i++) {
sizeInBytes += fieldBlocks[i].getRegionSizeInBytes(startFieldBlockOffset, fieldBlockLength);
}
this.sizeInBytes = sizeInBytes;
}
代码示例来源:origin: prestodb/presto
@Override
public long getRegionSizeInBytes(int positionOffset, int length)
{
return block.getRegionSizeInBytes(positionOffset, length);
}
代码示例来源:origin: prestodb/presto
private void calculateSize()
{
int entriesStart = offsets[startOffset];
int entriesEnd = offsets[startOffset + positionCount];
int entryCount = entriesEnd - entriesStart;
sizeInBytes = keyBlock.getRegionSizeInBytes(entriesStart, entryCount) +
valueBlock.getRegionSizeInBytes(entriesStart, entryCount) +
(Integer.BYTES + Byte.BYTES) * (long) this.positionCount +
Integer.BYTES * HASH_MULTIPLIER * (long) entryCount;
}
代码示例来源:origin: prestodb/presto
@Override
public long getSizeInBytes()
{
return keyBlock.getRegionSizeInBytes(offset / 2, positionCount / 2) +
valueBlock.getRegionSizeInBytes(offset / 2, positionCount / 2) +
sizeOfIntArray(positionCount / 2 * HASH_MULTIPLIER);
}
代码示例来源:origin: prestodb/presto
@Override
public long getRegionSizeInBytes(int position, int length)
{
assureLoaded();
return block.getRegionSizeInBytes(position, length);
}
代码示例来源:origin: prestodb/presto
@Override
public long getSizeInBytes()
{
long sizeInBytes = 0;
for (int i = 0; i < fieldBlocks.length; i++) {
sizeInBytes += getRawFieldBlock(i).getRegionSizeInBytes(rowIndex, 1);
}
return sizeInBytes;
}
代码示例来源:origin: prestodb/presto
@Override
public long getLogicalSizeInBytes()
{
if (logicalSizeInBytes >= 0) {
return logicalSizeInBytes;
}
// Calculation of logical size can be performed as part of calculateCompactSize() with minor modifications.
// Keeping this calculation separate as this is a little more expensive and may not be called as often.
long sizeInBytes = 0;
long[] seenSizes = new long[dictionary.getPositionCount()];
Arrays.fill(seenSizes, -1L);
for (int i = 0; i < getPositionCount(); i++) {
int position = getId(i);
if (seenSizes[position] < 0) {
seenSizes[position] = dictionary.getRegionSizeInBytes(position, 1);
}
sizeInBytes += seenSizes[position];
}
logicalSizeInBytes = sizeInBytes;
return sizeInBytes;
}
代码示例来源:origin: prestodb/presto
@Override
public long getRegionSizeInBytes(int position, int length)
{
int positionCount = getPositionCount();
checkValidRegion(positionCount, position, length);
int entriesStart = getOffsets()[getOffsetBase() + position];
int entriesEnd = getOffsets()[getOffsetBase() + position + length];
int entryCount = entriesEnd - entriesStart;
return getRawKeyBlock().getRegionSizeInBytes(entriesStart, entryCount) +
getRawValueBlock().getRegionSizeInBytes(entriesStart, entryCount) +
(Integer.BYTES + Byte.BYTES) * (long) length +
Integer.BYTES * HASH_MULTIPLIER * (long) entryCount;
}
代码示例来源:origin: prestodb/presto
@Override
public long getRegionSizeInBytes(int position, int length)
{
int positionCount = getPositionCount();
checkValidRegion(positionCount, position, length);
int startFieldBlockOffset = getFieldBlockOffset(position);
int endFieldBlockOffset = getFieldBlockOffset(position + length);
int fieldBlockLength = endFieldBlockOffset - startFieldBlockOffset;
long regionSizeInBytes = (Integer.BYTES + Byte.BYTES) * (long) length;
for (int i = 0; i < numFields; i++) {
regionSizeInBytes += getRawFieldBlocks()[i].getRegionSizeInBytes(startFieldBlockOffset, fieldBlockLength);
}
return regionSizeInBytes;
}
代码示例来源:origin: prestodb/presto
@Override
public long getRegionSizeInBytes(int position, int length)
{
int positionCount = getPositionCount();
checkValidRegion(positionCount, position, length);
int valueStart = getOffsets()[getOffsetBase() + position];
int valueEnd = getOffsets()[getOffsetBase() + position + length];
return getRawElementBlock().getRegionSizeInBytes(valueStart, valueEnd - valueStart) + ((Integer.BYTES + Byte.BYTES) * (long) length);
}
代码示例来源:origin: prestodb/presto
private void assertBlockSize(Block block)
{
// Asserting on `block` is not very effective because most blocks passed to this method is compact.
// Therefore, we split the `block` into two and assert again.
long expectedBlockSize = copyBlockViaBlockSerde(block).getSizeInBytes();
assertEquals(block.getSizeInBytes(), expectedBlockSize);
assertEquals(block.getRegionSizeInBytes(0, block.getPositionCount()), expectedBlockSize);
List<Block> splitBlock = splitBlock(block, 2);
Block firstHalf = splitBlock.get(0);
long expectedFirstHalfSize = copyBlockViaBlockSerde(firstHalf).getSizeInBytes();
assertEquals(firstHalf.getSizeInBytes(), expectedFirstHalfSize);
assertEquals(block.getRegionSizeInBytes(0, firstHalf.getPositionCount()), expectedFirstHalfSize);
Block secondHalf = splitBlock.get(1);
long expectedSecondHalfSize = copyBlockViaBlockSerde(secondHalf).getSizeInBytes();
assertEquals(secondHalf.getSizeInBytes(), expectedSecondHalfSize);
assertEquals(block.getRegionSizeInBytes(firstHalf.getPositionCount(), secondHalf.getPositionCount()), expectedSecondHalfSize);
boolean[] positions = new boolean[block.getPositionCount()];
fill(positions, 0, firstHalf.getPositionCount(), true);
assertEquals(block.getPositionsSizeInBytes(positions), expectedFirstHalfSize);
fill(positions, true);
assertEquals(block.getPositionsSizeInBytes(positions), expectedBlockSize);
fill(positions, 0, firstHalf.getPositionCount(), false);
assertEquals(block.getPositionsSizeInBytes(positions), expectedSecondHalfSize);
}
代码示例来源:origin: prestodb/presto
while (inputPage.getBlock(0).getRegionSizeInBytes(0, batchSize) > MAX_PAGE_SIZE_IN_BYTES) {
batchSize /= 2;
代码示例来源:origin: com.facebook.presto/presto-spi
private void calculateSize()
{
int startFieldBlockOffset = fieldBlockOffsets[startOffset];
int endFieldBlockOffset = fieldBlockOffsets[startOffset + positionCount];
int fieldBlockLength = endFieldBlockOffset - startFieldBlockOffset;
long sizeInBytes = (Integer.BYTES + Byte.BYTES) * (long) positionCount;
for (int i = 0; i < numFields; i++) {
sizeInBytes += fieldBlocks[i].getRegionSizeInBytes(startFieldBlockOffset, fieldBlockLength);
}
this.sizeInBytes = sizeInBytes;
}
代码示例来源:origin: com.facebook.presto/presto-spi
private void calculateSize()
{
int valueStart = offsets[arrayOffset];
int valueEnd = offsets[arrayOffset + positionCount];
sizeInBytes = values.getRegionSizeInBytes(valueStart, valueEnd - valueStart) + ((Integer.BYTES + Byte.BYTES) * (long) this.positionCount);
}
代码示例来源:origin: com.facebook.presto/presto-spi
private void calculateSize()
{
int entriesStart = offsets[startOffset];
int entriesEnd = offsets[startOffset + positionCount];
int entryCount = entriesEnd - entriesStart;
sizeInBytes = keyBlock.getRegionSizeInBytes(entriesStart, entryCount) +
valueBlock.getRegionSizeInBytes(entriesStart, entryCount) +
(Integer.BYTES + Byte.BYTES) * (long) this.positionCount +
Integer.BYTES * HASH_MULTIPLIER * (long) entryCount;
}
代码示例来源:origin: com.facebook.presto/presto-spi
@Override
public long getSizeInBytes()
{
return keyBlock.getRegionSizeInBytes(offset / 2, positionCount / 2) +
valueBlock.getRegionSizeInBytes(offset / 2, positionCount / 2) +
sizeOfIntArray(positionCount / 2 * HASH_MULTIPLIER);
}
代码示例来源:origin: com.facebook.presto/presto-spi
@Override
public long getRegionSizeInBytes(int position, int length)
{
assureLoaded();
return block.getRegionSizeInBytes(position, length);
}
代码示例来源:origin: com.facebook.presto/presto-spi
@Override
public long getSizeInBytes()
{
long sizeInBytes = 0;
for (int i = 0; i < fieldBlocks.length; i++) {
sizeInBytes += getRawFieldBlock(i).getRegionSizeInBytes(rowIndex, 1);
}
return sizeInBytes;
}
代码示例来源:origin: com.facebook.presto/presto-spi
@Override
public long getRegionSizeInBytes(int position, int length)
{
int positionCount = getPositionCount();
checkValidRegion(positionCount, position, length);
int valueStart = getOffsets()[getOffsetBase() + position];
int valueEnd = getOffsets()[getOffsetBase() + position + length];
return getRawElementBlock().getRegionSizeInBytes(valueStart, valueEnd - valueStart) + ((Integer.BYTES + Byte.BYTES) * (long) length);
}
内容来源于网络,如有侵权,请联系作者删除!