Search in sources :

Example 1 with StatsRecorder

use of com.facebook.presto.sql.planner.StatsRecorder in project presto by prestodb.

the class TestIterativeOptimizer method optimizerTimeoutsOnNonConvergingPlan.

@Test(timeOut = 1000)
public void optimizerTimeoutsOnNonConvergingPlan() {
    PlanOptimizer optimizer = new IterativeOptimizer(new StatsRecorder(), ImmutableSet.of(new NonConvergingRule()));
    try {
        queryRunner.inTransaction(transactionSession -> {
            queryRunner.createPlan(transactionSession, "SELECT * FROM nation", ImmutableList.of(optimizer));
            fail("The optimizer should not converge");
            return null;
        });
    } catch (PrestoException ex) {
        assertEquals(ex.getErrorCode(), OPTIMIZER_TIMEOUT.toErrorCode());
    }
}
Also used : StatsRecorder(com.facebook.presto.sql.planner.StatsRecorder) PlanOptimizer(com.facebook.presto.sql.planner.optimizations.PlanOptimizer) PrestoException(com.facebook.presto.spi.PrestoException) Test(org.testng.annotations.Test)

Aggregations

PrestoException (com.facebook.presto.spi.PrestoException)1 StatsRecorder (com.facebook.presto.sql.planner.StatsRecorder)1 PlanOptimizer (com.facebook.presto.sql.planner.optimizations.PlanOptimizer)1 Test (org.testng.annotations.Test)1