Search in sources :

Example 1 with OPTIMIZER_TIMEOUT

use of io.trino.spi.StandardErrorCode.OPTIMIZER_TIMEOUT in project trino by trinodb.

the class TestIterativeOptimizer method optimizerTimeoutsOnNonConvergingPlan.

@Test(timeOut = 10_000)
public void optimizerTimeoutsOnNonConvergingPlan() {
    PlanOptimizer optimizer = new IterativeOptimizer(queryRunner.getPlannerContext(), new RuleStatsRecorder(), queryRunner.getStatsCalculator(), queryRunner.getCostCalculator(), ImmutableSet.of(new AddIdentityOverTableScan(), new RemoveRedundantIdentityProjections()));
    assertTrinoExceptionThrownBy(() -> queryRunner.inTransaction(transactionSession -> queryRunner.createPlan(transactionSession, "SELECT nationkey FROM nation", ImmutableList.of(optimizer), WarningCollector.NOOP))).hasErrorCode(OPTIMIZER_TIMEOUT).hasMessageMatching("The optimizer exhausted the time limit of 1 ms: (no rules invoked|(?s)Top rules:.*(RemoveRedundantIdentityProjections|AddIdentityOverTableScan).*)");
}
Also used : AfterClass(org.testng.annotations.AfterClass) ImmutableSet(com.google.common.collect.ImmutableSet) RemoveRedundantIdentityProjections(io.trino.sql.planner.iterative.rule.RemoveRedundantIdentityProjections) ImmutableMap(com.google.common.collect.ImmutableMap) BeforeClass(org.testng.annotations.BeforeClass) Assignments(io.trino.sql.planner.plan.Assignments) Test(org.testng.annotations.Test) Patterns.tableScan(io.trino.sql.planner.plan.Patterns.tableScan) TrinoExceptionAssert.assertTrinoExceptionThrownBy(io.trino.testing.assertions.TrinoExceptionAssert.assertTrinoExceptionThrownBy) RuleStatsRecorder(io.trino.sql.planner.RuleStatsRecorder) TestingSession.testSessionBuilder(io.trino.testing.TestingSession.testSessionBuilder) Pattern(io.trino.matching.Pattern) ImmutableList(com.google.common.collect.ImmutableList) Captures(io.trino.matching.Captures) TpchConnectorFactory(io.trino.plugin.tpch.TpchConnectorFactory) PlanOptimizer(io.trino.sql.planner.optimizations.PlanOptimizer) LocalQueryRunner(io.trino.testing.LocalQueryRunner) WarningCollector(io.trino.execution.warnings.WarningCollector) ProjectNode(io.trino.sql.planner.plan.ProjectNode) TableScanNode(io.trino.sql.planner.plan.TableScanNode) OPTIMIZER_TIMEOUT(io.trino.spi.StandardErrorCode.OPTIMIZER_TIMEOUT) Session(io.trino.Session) PlanOptimizer(io.trino.sql.planner.optimizations.PlanOptimizer) RuleStatsRecorder(io.trino.sql.planner.RuleStatsRecorder) RemoveRedundantIdentityProjections(io.trino.sql.planner.iterative.rule.RemoveRedundantIdentityProjections) Test(org.testng.annotations.Test)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 Session (io.trino.Session)1 WarningCollector (io.trino.execution.warnings.WarningCollector)1 Captures (io.trino.matching.Captures)1 Pattern (io.trino.matching.Pattern)1 TpchConnectorFactory (io.trino.plugin.tpch.TpchConnectorFactory)1 OPTIMIZER_TIMEOUT (io.trino.spi.StandardErrorCode.OPTIMIZER_TIMEOUT)1 RuleStatsRecorder (io.trino.sql.planner.RuleStatsRecorder)1 RemoveRedundantIdentityProjections (io.trino.sql.planner.iterative.rule.RemoveRedundantIdentityProjections)1 PlanOptimizer (io.trino.sql.planner.optimizations.PlanOptimizer)1 Assignments (io.trino.sql.planner.plan.Assignments)1 Patterns.tableScan (io.trino.sql.planner.plan.Patterns.tableScan)1 ProjectNode (io.trino.sql.planner.plan.ProjectNode)1 TableScanNode (io.trino.sql.planner.plan.TableScanNode)1 LocalQueryRunner (io.trino.testing.LocalQueryRunner)1 TestingSession.testSessionBuilder (io.trino.testing.TestingSession.testSessionBuilder)1 TrinoExceptionAssert.assertTrinoExceptionThrownBy (io.trino.testing.assertions.TrinoExceptionAssert.assertTrinoExceptionThrownBy)1 AfterClass (org.testng.annotations.AfterClass)1