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)));
}
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);
}
Aggregations