use of com.facebook.presto.orc.writer.CompressionBufferPool.LastUsedCompressionBufferPool in project presto by prestodb.
the class TestCompressionBufferPool method testLargeBuffer.
@Test
public void testLargeBuffer() {
CompressionBufferPool bufferPool = new LastUsedCompressionBufferPool();
byte[] buffer1 = bufferPool.checkOut(1000);
verifyBuffer(buffer1, 1000);
bufferPool.checkIn(buffer1);
byte[] buffer2 = bufferPool.checkOut(500);
assertSame(buffer1, buffer2);
bufferPool.checkIn(buffer2);
byte[] buffer3 = bufferPool.checkOut(2000);
verifyBuffer(buffer3, 2000);
}
use of com.facebook.presto.orc.writer.CompressionBufferPool.LastUsedCompressionBufferPool in project presto by prestodb.
the class TestCompressionBufferPool method testBufferReuse.
@Test
public void testBufferReuse() {
CompressionBufferPool bufferPool = new LastUsedCompressionBufferPool();
byte[] buffer1 = bufferPool.checkOut(0);
verifyBuffer(buffer1, 0);
bufferPool.checkIn(buffer1);
byte[] buffer2 = bufferPool.checkOut(0);
assertSame(buffer1, buffer2);
// Do not checkIn buffer2, but ask for another buffer
byte[] buffer3 = bufferPool.checkOut(0);
assertNotSame(buffer1, buffer3);
verifyBuffer(buffer3, 0);
bufferPool.checkIn(buffer3);
}
Aggregations