io.airlift.slice.Slice.getRetainedSize()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(222)

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

Slice.getRetainedSize介绍

[英]Approximate number of bytes retained by this slice.
[中]此片保留的大致字节数。

代码示例

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

@Override
public long getRetainedSize()
{
  return slice.getRetainedSize() + closedSlicesRetainedSize + INSTANCE_SIZE;
}

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

@Override
public long getRetainedSize()
{
  return slice.getRetainedSize() + INSTANCE_SIZE;
}

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

public long getRetainedSizeInBytes()
{
  return INSTANCE_SIZE + slice.getRetainedSize() + PAGE_COMPRESSION_SIZE;
}

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

@Override
public long getRetainedSizeInBytes()
{
  return INSTANCE_SIZE + (minimum == null ? 0 : minimum.getRetainedSize()) + ((maximum == null || maximum == minimum) ? 0 : maximum.getRetainedSize());
}

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

@Override
public long getRetainedSize()
{
  return slice.getRetainedSize() + closedSlicesRetainedSize + INSTANCE_SIZE;
}

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

@Override
public void retainedBytesForEachPart(BiConsumer<Object, Long> consumer)
{
  consumer.accept(slice, slice.getRetainedSize());
  if (valueIsNull != null) {
    consumer.accept(valueIsNull, valueIsNull.getRetainedSize());
  }
  consumer.accept(this, (long) INSTANCE_SIZE);
}

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

@Override
public long getRetainedSizeInBytes()
{
  return INSTANCE_SIZE + getRawSlice().getRetainedSize() + (valueIsNull == null ? 0 : valueIsNull.getRetainedSize());
}

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

@Override
public void retainedBytesForEachPart(BiConsumer<Object, Long> consumer)
{
  consumer.accept(slice, slice.getRetainedSize());
  consumer.accept(offsets, sizeOf(offsets));
  if (valueIsNull != null) {
    consumer.accept(valueIsNull, sizeOf(valueIsNull));
  }
  consumer.accept(this, (long) INSTANCE_SIZE);
}

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

@Override
public long getRetainedSize()
{
  return INSTANCE_SIZE + compressedOutputStream.getRetainedSize() + slice.getRetainedSize() + SizeOf.sizeOf(compressionBuffer);
}

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

private void closeChunk()
{
  // add trimmed view of slice to closed slices
  closedSlices.add(slice.slice(0, bufferPosition));
  closedSlicesRetainedSize += slice.getRetainedSize();
  // create a new buffer
  // double size until we hit the max chunk size
  buffer = chunkSupplier.get();
  slice = Slices.wrappedBuffer(buffer);
  streamOffset += bufferPosition;
  bufferPosition = 0;
}

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

@Test
  public void testRetainedSize()
  {
    assertRetainedSize(EMPTY_SLICE, LOW_BOTTOM_VALUE, INSTANCE_SIZE + EMPTY_SLICE.getRetainedSize() + LOW_BOTTOM_VALUE.getRetainedSize());
    assertRetainedSize(LOW_TOP_VALUE, LOW_TOP_VALUE, INSTANCE_SIZE + LOW_TOP_VALUE.getRetainedSize());
    assertRetainedSize(EMPTY_SLICE, EMPTY_SLICE, INSTANCE_SIZE + EMPTY_SLICE.getRetainedSize());
    assertRetainedSize(MEDIUM_TOP_VALUE, HIGH_BOTTOM_VALUE, INSTANCE_SIZE + MEDIUM_TOP_VALUE.getRetainedSize() + HIGH_BOTTOM_VALUE.getRetainedSize());
    assertRetainedSize(null, HIGH_BOTTOM_VALUE, INSTANCE_SIZE + HIGH_BOTTOM_VALUE.getRetainedSize());
    assertRetainedSize(EMPTY_SLICE, null, INSTANCE_SIZE + EMPTY_SLICE.getRetainedSize());
    assertRetainedSize(null, null, INSTANCE_SIZE);
  }
}

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

@Test
public void testCopyStatsToSaveMemory()
{
  StringStatisticsBuilder statisticsBuilder = new StringStatisticsBuilder(Integer.MAX_VALUE);
  Slice shortSlice = Slices.wrappedBuffer(LONG_BOTTOM_VALUE.getBytes(), 0, 1);
  statisticsBuilder.addValue(shortSlice);
  Slice stats = statisticsBuilder.buildColumnStatistics().getStringStatistics().getMax();
  // assert we only spend 1 byte for stats
  assertNotNull(stats);
  assertEquals(stats.getRetainedSize(), Slices.wrappedBuffer(new byte[1]).getRetainedSize());
}

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

@Override
protected LongInputStreamV2 createValueStream(Slice slice)
    throws OrcCorruptionException
{
  Optional<OrcDecompressor> orcDecompressor = createOrcDecompressor(ORC_DATA_SOURCE_ID, SNAPPY, COMPRESSION_BLOCK_SIZE);
  OrcInputStream input = new OrcInputStream(ORC_DATA_SOURCE_ID, slice.getInput(), orcDecompressor, newSimpleAggregatedMemoryContext(), slice.getRetainedSize());
  return new LongInputStreamV2(input, true, false);
}

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

@Override
protected LongInputStreamV1 createValueStream(Slice slice)
    throws OrcCorruptionException
{
  Optional<OrcDecompressor> orcDecompressor = createOrcDecompressor(ORC_DATA_SOURCE_ID, SNAPPY, COMPRESSION_BLOCK_SIZE);
  OrcInputStream input = new OrcInputStream(ORC_DATA_SOURCE_ID, slice.getInput(), orcDecompressor, newSimpleAggregatedMemoryContext(), slice.getRetainedSize());
  return new LongInputStreamV1(input, true);
}

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

@Override
protected BooleanInputStream createValueStream(Slice slice)
    throws OrcCorruptionException
{
  Optional<OrcDecompressor> orcDecompressor = createOrcDecompressor(ORC_DATA_SOURCE_ID, SNAPPY, COMPRESSION_BLOCK_SIZE);
  return new BooleanInputStream(new OrcInputStream(ORC_DATA_SOURCE_ID, slice.getInput(), orcDecompressor, newSimpleAggregatedMemoryContext(), slice.getRetainedSize()));
}

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

@Override
protected FloatInputStream createValueStream(Slice slice)
    throws OrcCorruptionException
{
  Optional<OrcDecompressor> orcDecompressor = createOrcDecompressor(ORC_DATA_SOURCE_ID, SNAPPY, COMPRESSION_BLOCK_SIZE);
  return new FloatInputStream(new OrcInputStream(ORC_DATA_SOURCE_ID, slice.getInput(), orcDecompressor, newSimpleAggregatedMemoryContext(), slice.getRetainedSize()));
}

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

@Override
protected ByteInputStream createValueStream(Slice slice)
    throws OrcCorruptionException
{
  Optional<OrcDecompressor> orcDecompressor = createOrcDecompressor(ORC_DATA_SOURCE_ID, SNAPPY, COMPRESSION_BLOCK_SIZE);
  return new ByteInputStream(new OrcInputStream(ORC_DATA_SOURCE_ID, slice.getInput(), orcDecompressor, newSimpleAggregatedMemoryContext(), slice.getRetainedSize()));
}

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

@Override
protected DoubleInputStream createValueStream(Slice slice)
    throws OrcCorruptionException
{
  Optional<OrcDecompressor> orcDecompressor = createOrcDecompressor(ORC_DATA_SOURCE_ID, SNAPPY, COMPRESSION_BLOCK_SIZE);
  return new DoubleInputStream(new OrcInputStream(ORC_DATA_SOURCE_ID, slice.getInput(), orcDecompressor, newSimpleAggregatedMemoryContext(), slice.getRetainedSize()));
}

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

@Override
protected ByteArrayInputStream createValueStream(Slice slice)
    throws OrcCorruptionException
{
  Optional<OrcDecompressor> orcDecompressor = createOrcDecompressor(ORC_DATA_SOURCE_ID, SNAPPY, COMPRESSION_BLOCK_SIZE);
  return new ByteArrayInputStream(new OrcInputStream(ORC_DATA_SOURCE_ID, slice.getInput(), orcDecompressor, newSimpleAggregatedMemoryContext(), slice.getRetainedSize()));
}

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

@Override
protected DecimalInputStream createValueStream(Slice slice)
    throws OrcCorruptionException
{
  Optional<OrcDecompressor> orcDecompressor = createOrcDecompressor(ORC_DATA_SOURCE_ID, SNAPPY, COMPRESSION_BLOCK_SIZE);
  return new DecimalInputStream(new OrcInputStream(ORC_DATA_SOURCE_ID, slice.getInput(), orcDecompressor, newSimpleAggregatedMemoryContext(), slice.getRetainedSize()));
}

相关文章