Search in sources :

Example 16 with PlanFragment

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())));
}
Also used : ImmutableSet(com.google.common.collect.ImmutableSet) Set(java.util.Set) PlanFragment(io.trino.sql.planner.PlanFragment) PlanUtils.createExchangePlanFragment(io.trino.execution.scheduler.policy.PlanUtils.createExchangePlanFragment) PlanUtils.createBroadcastJoinPlanFragment(io.trino.execution.scheduler.policy.PlanUtils.createBroadcastJoinPlanFragment) PlanUtils.createTableScanPlanFragment(io.trino.execution.scheduler.policy.PlanUtils.createTableScanPlanFragment) PlanUtils.createJoinPlanFragment(io.trino.execution.scheduler.policy.PlanUtils.createJoinPlanFragment) PlanUtils.createUnionPlanFragment(io.trino.execution.scheduler.policy.PlanUtils.createUnionPlanFragment) Test(org.testng.annotations.Test)

Example 17 with PlanFragment

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())));
}
Also used : ImmutableSet(com.google.common.collect.ImmutableSet) Set(java.util.Set) PlanFragment(io.trino.sql.planner.PlanFragment) PlanUtils.createExchangePlanFragment(io.trino.execution.scheduler.policy.PlanUtils.createExchangePlanFragment) PlanUtils.createBroadcastJoinPlanFragment(io.trino.execution.scheduler.policy.PlanUtils.createBroadcastJoinPlanFragment) PlanUtils.createTableScanPlanFragment(io.trino.execution.scheduler.policy.PlanUtils.createTableScanPlanFragment) PlanUtils.createJoinPlanFragment(io.trino.execution.scheduler.policy.PlanUtils.createJoinPlanFragment) PlanUtils.createUnionPlanFragment(io.trino.execution.scheduler.policy.PlanUtils.createUnionPlanFragment) Test(org.testng.annotations.Test)

Example 18 with PlanFragment

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())));
}
Also used : ImmutableSet(com.google.common.collect.ImmutableSet) Set(java.util.Set) PlanFragment(io.trino.sql.planner.PlanFragment) PlanUtils.createExchangePlanFragment(io.trino.execution.scheduler.policy.PlanUtils.createExchangePlanFragment) PlanUtils.createBroadcastJoinPlanFragment(io.trino.execution.scheduler.policy.PlanUtils.createBroadcastJoinPlanFragment) PlanUtils.createTableScanPlanFragment(io.trino.execution.scheduler.policy.PlanUtils.createTableScanPlanFragment) PlanUtils.createJoinPlanFragment(io.trino.execution.scheduler.policy.PlanUtils.createJoinPlanFragment) PlanUtils.createUnionPlanFragment(io.trino.execution.scheduler.policy.PlanUtils.createUnionPlanFragment) Test(org.testng.annotations.Test)

Example 19 with PlanFragment

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())));
}
Also used : ImmutableSet(com.google.common.collect.ImmutableSet) Set(java.util.Set) PlanFragment(io.trino.sql.planner.PlanFragment) PlanUtils.createExchangePlanFragment(io.trino.execution.scheduler.policy.PlanUtils.createExchangePlanFragment) PlanUtils.createBroadcastJoinPlanFragment(io.trino.execution.scheduler.policy.PlanUtils.createBroadcastJoinPlanFragment) PlanUtils.createTableScanPlanFragment(io.trino.execution.scheduler.policy.PlanUtils.createTableScanPlanFragment) PlanUtils.createJoinPlanFragment(io.trino.execution.scheduler.policy.PlanUtils.createJoinPlanFragment) PlanUtils.createUnionPlanFragment(io.trino.execution.scheduler.policy.PlanUtils.createUnionPlanFragment) Test(org.testng.annotations.Test)

Example 20 with PlanFragment

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());
}
Also used : FragmentsEdge(io.trino.execution.scheduler.policy.PhasedExecutionSchedule.FragmentsEdge) PlanFragmentId(io.trino.sql.planner.plan.PlanFragmentId) PlanFragment(io.trino.sql.planner.PlanFragment) PlanUtils.createTableScanPlanFragment(io.trino.execution.scheduler.policy.PlanUtils.createTableScanPlanFragment) PlanUtils.createJoinPlanFragment(io.trino.execution.scheduler.policy.PlanUtils.createJoinPlanFragment) PlanUtils.createBroadcastJoinPlanFragment(io.trino.execution.scheduler.policy.PlanUtils.createBroadcastJoinPlanFragment) PlanUtils.createBroadcastAndPartitionedJoinPlanFragment(io.trino.execution.scheduler.policy.PlanUtils.createBroadcastAndPartitionedJoinPlanFragment) Test(org.testng.annotations.Test)

Aggregations

PlanFragment (io.trino.sql.planner.PlanFragment)41 Test (org.testng.annotations.Test)22 PlanFragmentId (io.trino.sql.planner.plan.PlanFragmentId)16 ImmutableSet (com.google.common.collect.ImmutableSet)12 NodeTaskMap (io.trino.execution.NodeTaskMap)11 PipelinedStageExecution.createPipelinedStageExecution (io.trino.execution.scheduler.PipelinedStageExecution.createPipelinedStageExecution)11 SourcePartitionedScheduler.newSourcePartitionedSchedulerAsStageScheduler (io.trino.execution.scheduler.SourcePartitionedScheduler.newSourcePartitionedSchedulerAsStageScheduler)11 PlanUtils.createBroadcastJoinPlanFragment (io.trino.execution.scheduler.policy.PlanUtils.createBroadcastJoinPlanFragment)11 PlanUtils.createJoinPlanFragment (io.trino.execution.scheduler.policy.PlanUtils.createJoinPlanFragment)11 PlanUtils.createTableScanPlanFragment (io.trino.execution.scheduler.policy.PlanUtils.createTableScanPlanFragment)11 Set (java.util.Set)11 Symbol (io.trino.sql.planner.Symbol)10 PlanNodeId (io.trino.sql.planner.plan.PlanNodeId)10 PartitioningScheme (io.trino.sql.planner.PartitioningScheme)9 MockRemoteTask (io.trino.execution.MockRemoteTaskFactory.MockRemoteTask)8 PartitionedSplitsInfo (io.trino.execution.PartitionedSplitsInfo)8 RemoteTask (io.trino.execution.RemoteTask)8 RemoteSourceNode (io.trino.sql.planner.plan.RemoteSourceNode)8 JoinNode (io.trino.sql.planner.plan.JoinNode)7 Duration (io.airlift.units.Duration)6