com.facebook.presto.spi.block.Block.getLogicalSizeInBytes()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(3.2k)|赞(0)|评价(0)|浏览(96)

本文整理了Java中com.facebook.presto.spi.block.Block.getLogicalSizeInBytes()方法的一些代码示例,展示了Block.getLogicalSizeInBytes()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Block.getLogicalSizeInBytes()方法的具体详情如下:
包路径:com.facebook.presto.spi.block.Block
类名称:Block
方法名:getLogicalSizeInBytes

Block.getLogicalSizeInBytes介绍

[英]Returns the size of the block contents, regardless of internal representation. The same logical data values should always have the same size, no matter what block type is used or how they are represented within a specific block. This can differ substantially from #getSizeInBytes for certain block types. For RLE, it will be N times larger. For dictionary, it will be larger based on how many times dictionary entries are reused.
[中]返回块内容的大小,而不考虑内部表示形式。相同的逻辑数据值应始终具有相同的大小,无论使用什么块类型或它们在特定块中如何表示。对于某些块类型,这可能与#getSizeInBytes有很大不同。对于RLE,它将是N倍大。对于字典,它将根据字典条目被重用的次数而变大。

代码示例

代码示例来源:origin: prestodb/presto

@Override
public long getLogicalSizeInBytes()
{
  return positionCount * value.getLogicalSizeInBytes();
}

代码示例来源:origin: prestodb/presto

public long getLogicalSizeInBytes()
{
  long size = logicalSizeInBytes.get();
  if (size < 0) {
    size = 0;
    for (Block block : blocks) {
      size += block.getLogicalSizeInBytes();
    }
    logicalSizeInBytes.set(size);
  }
  return size;
}

代码示例来源:origin: prestodb/presto

@Test
public void testLogicalSizeInBytes()
{
  // The 10 Slices in the array will be of lengths 0 to 9.
  Slice[] expectedValues = createExpectedValues(10);
  // The dictionary within the dictionary block is expected to be a VariableWidthBlock of size 95 bytes.
  // 45 bytes for the expectedValues Slices (sum of seq(0,9)) and 50 bytes for the position and isNull array (total 10 positions).
  DictionaryBlock dictionaryBlock = createDictionaryBlock(expectedValues, 100);
  assertEquals(dictionaryBlock.getDictionary().getLogicalSizeInBytes(), 95);
  // The 100 positions in the dictionary block index to 10 positions in the underlying dictionary (10 each).
  // Logical size calculation accounts for 4 bytes of offset and 1 byte of isNull. Therefore the expected unoptimized
  // size is 10 times the size of the underlying dictionary (VariableWidthBlock).
  assertEquals(dictionaryBlock.getLogicalSizeInBytes(), 95 * 10);
  // With alternating nulls, we have 21 positions, with the same size calculation as above.
  dictionaryBlock = createDictionaryBlock(alternatingNullValues(expectedValues), 210);
  assertEquals(dictionaryBlock.getDictionary().getPositionCount(), 21);
  assertEquals(dictionaryBlock.getDictionary().getLogicalSizeInBytes(), 150);
  // The null positions should be included in the logical size.
  assertEquals(dictionaryBlock.getLogicalSizeInBytes(), 150 * 10);
}

代码示例来源:origin: prestodb/presto

while (chunkPositionCount > 1 && chunk.getLogicalSizeInBytes() > DIRECT_CONVERSION_CHUNK_MAX_LOGICAL_BYTES) {
  chunkPositionCount /= 2;
  chunk = chunk.getRegion(0, chunkPositionCount);

代码示例来源:origin: com.facebook.presto/presto-spi

@Override
public long getLogicalSizeInBytes()
{
  return positionCount * value.getLogicalSizeInBytes();
}

代码示例来源:origin: com.facebook.presto/presto-spi

public long getLogicalSizeInBytes()
{
  long size = logicalSizeInBytes.get();
  if (size < 0) {
    size = 0;
    for (Block block : blocks) {
      size += block.getLogicalSizeInBytes();
    }
    logicalSizeInBytes.set(size);
  }
  return size;
}

代码示例来源:origin: com.facebook.presto/presto-orc

while (chunkPositionCount > 1 && chunk.getLogicalSizeInBytes() > DIRECT_CONVERSION_CHUNK_MAX_LOGICAL_BYTES) {
  chunkPositionCount /= 2;
  chunk = chunk.getRegion(0, chunkPositionCount);

相关文章