@Override public long getRetainedSize() { return slice.getRetainedSize() + closedSlicesRetainedSize + INSTANCE_SIZE; }
@Override public long getRetainedSize() { return slice.getRetainedSize() + INSTANCE_SIZE; }
public long getRetainedSizeInBytes() { return INSTANCE_SIZE + slice.getRetainedSize() + PAGE_COMPRESSION_SIZE; }
@Override public long getRetainedSizeInBytes() { return INSTANCE_SIZE + (minimum == null ? 0 : minimum.getRetainedSize()) + ((maximum == null || maximum == minimum) ? 0 : maximum.getRetainedSize()); }
@Override public long getRetainedSize() { return slice.getRetainedSize() + closedSlicesRetainedSize + INSTANCE_SIZE; }
@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); }
@Override public long getRetainedSizeInBytes() { return INSTANCE_SIZE + getRawSlice().getRetainedSize() + (valueIsNull == null ? 0 : valueIsNull.getRetainedSize()); }
@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); }
@Override public long getRetainedSize() { return INSTANCE_SIZE + compressedOutputStream.getRetainedSize() + slice.getRetainedSize() + SizeOf.sizeOf(compressionBuffer); }
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; }
@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); } }
@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()); }
@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); }
@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); }
@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())); }
@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())); }
@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())); }
@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())); }
@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())); }
@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())); }