use of com.facebook.presto.operator.SourceOperator in project presto by prestodb.
the class TestOrcBatchPageSourceMemoryTracking method testScanFilterAndProjectOperator.
@Test
public void testScanFilterAndProjectOperator() {
// Numbers used in assertions in this test may change when implementation is modified,
// feel free to change them if they break in the future
DriverContext driverContext = testPreparer.newDriverContext();
SourceOperator operator = testPreparer.newScanFilterAndProjectOperator(driverContext);
assertEquals(driverContext.getSystemMemoryUsage(), 0);
int totalRows = 0;
while (totalRows < NUM_ROWS) {
assertFalse(operator.isFinished());
Page page = operator.getOutput();
assertNotNull(page);
assertBetweenInclusive(driverContext.getSystemMemoryUsage(), 90_000L, 619999L);
totalRows += page.getPositionCount();
}
// done... in the current implementation finish is not set until output returns a null page
assertNull(operator.getOutput());
assertTrue(operator.isFinished());
assertBetweenInclusive(driverContext.getSystemMemoryUsage(), 0L, 500L);
}
use of com.facebook.presto.operator.SourceOperator in project presto by prestodb.
the class TestOrcBatchPageSourceMemoryTracking method testTableScanOperator.
@Test
public void testTableScanOperator() {
// Numbers used in assertions in this test may change when implementation is modified,
// feel free to change them if they break in the future
DriverContext driverContext = testPreparer.newDriverContext();
SourceOperator operator = testPreparer.newTableScanOperator(driverContext);
assertEquals(driverContext.getSystemMemoryUsage(), 0);
int totalRows = 0;
while (totalRows < 20000) {
assertFalse(operator.isFinished());
Page page = operator.getOutput();
assertNotNull(page);
page.getBlock(1);
assertBetweenInclusive(driverContext.getSystemMemoryUsage(), 390000L, 619999L);
totalRows += page.getPositionCount();
}
while (totalRows < 40000) {
assertFalse(operator.isFinished());
Page page = operator.getOutput();
assertNotNull(page);
page.getBlock(1);
assertBetweenInclusive(driverContext.getSystemMemoryUsage(), 390000L, 619999L);
totalRows += page.getPositionCount();
}
while (totalRows < NUM_ROWS) {
assertFalse(operator.isFinished());
Page page = operator.getOutput();
assertNotNull(page);
page.getBlock(1);
assertBetweenInclusive(driverContext.getSystemMemoryUsage(), 430000L, 459999L);
totalRows += page.getPositionCount();
}
assertFalse(operator.isFinished());
assertNull(operator.getOutput());
assertTrue(operator.isFinished());
assertEquals(driverContext.getSystemMemoryUsage(), 0);
}
Aggregations