Search in sources :

Example 1 with TaskCountEstimator

use of io.trino.cost.TaskCountEstimator in project trino by trinodb.

the class TestDetermineTableScanNodePartitioning method testPlanWithTableNodePartitioning.

private void testPlanWithTableNodePartitioning(Session session, TableHandle tableHandle, ConnectorTableHandle connectorTableHandle, int numberOfTasks, boolean expectedEnabled) {
    tester.assertThat(new DetermineTableScanNodePartitioning(tester.getMetadata(), tester.getQueryRunner().getNodePartitioningManager(), new TaskCountEstimator(() -> numberOfTasks))).on(p -> {
        Symbol a = p.symbol(COLUMN_A);
        Symbol b = p.symbol(COLUMN_B);
        return p.tableScan(tableHandle, ImmutableList.of(a, b), ImmutableMap.of(a, COLUMN_HANDLE_A, b, COLUMN_HANDLE_B));
    }).withSession(session).matches(tableScan(connectorTableHandle::equals, TupleDomain.all(), ImmutableMap.of("A", COLUMN_HANDLE_A::equals, "B", COLUMN_HANDLE_B::equals)).with(planWithTableNodePartitioning(expectedEnabled)));
}
Also used : TaskCountEstimator(io.trino.cost.TaskCountEstimator) Symbol(io.trino.sql.planner.Symbol)

Example 2 with TaskCountEstimator

use of io.trino.cost.TaskCountEstimator in project trino by trinodb.

the class TestEliminateSorts method assertUnitPlan.

private void assertUnitPlan(@Language("SQL") String sql, PlanMatchPattern pattern) {
    TypeAnalyzer typeAnalyzer = createTestingTypeAnalyzer(getQueryRunner().getPlannerContext());
    List<PlanOptimizer> optimizers = ImmutableList.of(new IterativeOptimizer(getQueryRunner().getPlannerContext(), new RuleStatsRecorder(), getQueryRunner().getStatsCalculator(), getQueryRunner().getCostCalculator(), ImmutableSet.of(new RemoveRedundantIdentityProjections(), new DetermineTableScanNodePartitioning(getQueryRunner().getMetadata(), getQueryRunner().getNodePartitioningManager(), new TaskCountEstimator(() -> 10)))), new AddExchanges(getQueryRunner().getPlannerContext(), typeAnalyzer, getQueryRunner().getStatsCalculator()));
    assertPlan(sql, pattern, optimizers);
}
Also used : TaskCountEstimator(io.trino.cost.TaskCountEstimator) RuleStatsRecorder(io.trino.sql.planner.RuleStatsRecorder) RemoveRedundantIdentityProjections(io.trino.sql.planner.iterative.rule.RemoveRedundantIdentityProjections) IterativeOptimizer(io.trino.sql.planner.iterative.IterativeOptimizer) DetermineTableScanNodePartitioning(io.trino.sql.planner.iterative.rule.DetermineTableScanNodePartitioning) TypeAnalyzer.createTestingTypeAnalyzer(io.trino.sql.planner.TypeAnalyzer.createTestingTypeAnalyzer) TypeAnalyzer(io.trino.sql.planner.TypeAnalyzer)

Aggregations

TaskCountEstimator (io.trino.cost.TaskCountEstimator)2 RuleStatsRecorder (io.trino.sql.planner.RuleStatsRecorder)1 Symbol (io.trino.sql.planner.Symbol)1 TypeAnalyzer (io.trino.sql.planner.TypeAnalyzer)1 TypeAnalyzer.createTestingTypeAnalyzer (io.trino.sql.planner.TypeAnalyzer.createTestingTypeAnalyzer)1 IterativeOptimizer (io.trino.sql.planner.iterative.IterativeOptimizer)1 DetermineTableScanNodePartitioning (io.trino.sql.planner.iterative.rule.DetermineTableScanNodePartitioning)1 RemoveRedundantIdentityProjections (io.trino.sql.planner.iterative.rule.RemoveRedundantIdentityProjections)1