use of io.prestosql.ExceededMemoryLimitException in project hetu-core by openlookeng.
the class TestTopNOperator method testExceedMemoryLimit.
@Test
public void testExceedMemoryLimit() throws Exception {
List<Page> input = rowPagesBuilder(BIGINT).row(1L).build();
DriverContext smallDiverContext = createTaskContext(executor, scheduledExecutor, TEST_SESSION, new DataSize(1, BYTE)).addPipelineContext(0, true, true, false).addDriverContext();
OperatorFactory operatorFactory = topNOperatorFactory(ImmutableList.of(BIGINT), 100, ImmutableList.of(0), ImmutableList.of(ASC_NULLS_LAST));
try (Operator operator = operatorFactory.createOperator(smallDiverContext)) {
operator.addInput(input.get(0));
operator.getOutput();
fail("must fail because of exceeding local memory limit");
} catch (ExceededMemoryLimitException ignore) {
// the exception could be ignored
}
}
use of io.prestosql.ExceededMemoryLimitException in project hetu-core by openlookeng.
the class TestMemoryTracking method testLocalTotalMemoryLimitExceeded.
@Test
public void testLocalTotalMemoryLimitExceeded() {
LocalMemoryContext systemMemoryContext = operatorContext.newLocalSystemMemoryContext("test");
systemMemoryContext.setBytes(100);
assertOperatorMemoryAllocations(operatorContext.getOperatorMemoryContext(), 0, 100, 0);
systemMemoryContext.setBytes(queryMaxTotalMemory.toBytes());
assertOperatorMemoryAllocations(operatorContext.getOperatorMemoryContext(), 0, queryMaxTotalMemory.toBytes(), 0);
try {
systemMemoryContext.setBytes(queryMaxTotalMemory.toBytes() + 1);
fail("allocation should hit the per-node total memory limit");
} catch (ExceededMemoryLimitException e) {
assertEquals(e.getMessage(), format("Query exceeded per-node total memory limit of %1$s [Allocated: %1$s, Delta: 1B, Top Consumers: {test=%1$s}]", queryMaxTotalMemory));
}
}
Aggregations