use of io.trino.sql.planner.PlanFragment in project trino by trinodb.
the class TestLegacyPhasedExecutionSchedule method testJoin.
@Test
public void testJoin() {
PlanFragment buildFragment = createTableScanPlanFragment("build");
PlanFragment probeFragment = createTableScanPlanFragment("probe");
PlanFragment joinFragment = createJoinPlanFragment(INNER, "join", buildFragment, probeFragment);
List<Set<PlanFragmentId>> phases = LegacyPhasedExecutionSchedule.extractPhases(ImmutableList.of(joinFragment, buildFragment, probeFragment));
assertEquals(phases, ImmutableList.of(ImmutableSet.of(joinFragment.getId()), ImmutableSet.of(buildFragment.getId()), ImmutableSet.of(probeFragment.getId())));
}
use of io.trino.sql.planner.PlanFragment in project trino by trinodb.
the class TestLegacyPhasedExecutionSchedule method testExchange.
@Test
public void testExchange() {
PlanFragment aFragment = createTableScanPlanFragment("a");
PlanFragment bFragment = createTableScanPlanFragment("b");
PlanFragment cFragment = createTableScanPlanFragment("c");
PlanFragment exchangeFragment = createExchangePlanFragment("exchange", aFragment, bFragment, cFragment);
List<Set<PlanFragmentId>> phases = LegacyPhasedExecutionSchedule.extractPhases(ImmutableList.of(aFragment, bFragment, cFragment, exchangeFragment));
assertEquals(phases, ImmutableList.of(ImmutableSet.of(exchangeFragment.getId()), ImmutableSet.of(aFragment.getId()), ImmutableSet.of(bFragment.getId()), ImmutableSet.of(cFragment.getId())));
}
use of io.trino.sql.planner.PlanFragment in project trino by trinodb.
the class TestLegacyPhasedExecutionSchedule method testUnion.
@Test
public void testUnion() {
PlanFragment aFragment = createTableScanPlanFragment("a");
PlanFragment bFragment = createTableScanPlanFragment("b");
PlanFragment cFragment = createTableScanPlanFragment("c");
PlanFragment unionFragment = createUnionPlanFragment("union", aFragment, bFragment, cFragment);
List<Set<PlanFragmentId>> phases = LegacyPhasedExecutionSchedule.extractPhases(ImmutableList.of(aFragment, bFragment, cFragment, unionFragment));
assertEquals(phases, ImmutableList.of(ImmutableSet.of(unionFragment.getId()), ImmutableSet.of(aFragment.getId()), ImmutableSet.of(bFragment.getId()), ImmutableSet.of(cFragment.getId())));
}
use of io.trino.sql.planner.PlanFragment in project trino by trinodb.
the class TestLegacyPhasedExecutionSchedule method testRightJoin.
@Test
public void testRightJoin() {
PlanFragment buildFragment = createTableScanPlanFragment("build");
PlanFragment probeFragment = createTableScanPlanFragment("probe");
PlanFragment joinFragment = createJoinPlanFragment(RIGHT, "join", buildFragment, probeFragment);
List<Set<PlanFragmentId>> phases = LegacyPhasedExecutionSchedule.extractPhases(ImmutableList.of(joinFragment, buildFragment, probeFragment));
assertEquals(phases, ImmutableList.of(ImmutableSet.of(joinFragment.getId()), ImmutableSet.of(buildFragment.getId()), ImmutableSet.of(probeFragment.getId())));
}
use of io.trino.sql.planner.PlanFragment in project trino by trinodb.
the class TestPhasedExecutionSchedule method testBroadcastSourceJoin.
@Test
public void testBroadcastSourceJoin() {
PlanFragment buildFragment = createTableScanPlanFragment("build");
PlanFragment joinSourceFragment = createBroadcastJoinPlanFragment("probe", buildFragment);
TestingStageExecution buildStage = new TestingStageExecution(buildFragment);
TestingStageExecution joinSourceStage = new TestingStageExecution(joinSourceFragment);
PhasedExecutionSchedule schedule = PhasedExecutionSchedule.forStages(ImmutableSet.of(joinSourceStage, buildStage), dynamicFilterService);
assertThat(schedule.getSortedFragments()).containsExactly(buildFragment.getId(), joinSourceFragment.getId());
// single dependency between build and join stages
DirectedGraph<PlanFragmentId, FragmentsEdge> dependencies = schedule.getFragmentDependency();
assertThat(dependencies.edgeSet()).containsExactlyInAnyOrder(new FragmentsEdge(buildFragment.getId(), joinSourceFragment.getId()));
// build stage should start immediately
assertThat(getActiveFragments(schedule)).containsExactly(buildFragment.getId());
// join stage should start after build stage buffer is full
buildStage.setAnyTaskBlocked(true);
schedule.schedule();
assertThat(getActiveFragments(schedule)).containsExactly(buildFragment.getId(), joinSourceFragment.getId());
}
Aggregations