Search in sources :

Example 1 with SingleDistributionTaskSource

use of io.trino.execution.scheduler.StageTaskSourceFactory.SingleDistributionTaskSource in project trino by trinodb.

the class TestStageTaskSourceFactory method testSingleDistributionTaskSource.

@Test
public void testSingleDistributionTaskSource() {
    ListMultimap<PlanNodeId, ExchangeSourceHandle> sources = ImmutableListMultimap.<PlanNodeId, ExchangeSourceHandle>builder().put(PLAN_NODE_1, new TestingExchangeSourceHandle(0, 123)).put(PLAN_NODE_2, new TestingExchangeSourceHandle(0, 321)).put(PLAN_NODE_1, new TestingExchangeSourceHandle(0, 222)).build();
    TaskSource taskSource = new SingleDistributionTaskSource(sources, DataSize.of(4, GIGABYTE));
    assertFalse(taskSource.isFinished());
    List<TaskDescriptor> tasks = taskSource.getMoreTasks();
    assertThat(tasks).hasSize(1);
    assertTrue(taskSource.isFinished());
    TaskDescriptor task = tasks.get(0);
    assertThat(task.getNodeRequirements().getCatalogName()).isEmpty();
    assertThat(task.getNodeRequirements().getAddresses()).isEmpty();
    assertEquals(task.getPartitionId(), 0);
    assertEquals(task.getExchangeSourceHandles(), sources);
    assertEquals(task.getSplits(), ImmutableListMultimap.of());
}
Also used : PlanNodeId(io.trino.sql.planner.plan.PlanNodeId) ExchangeSourceHandle(io.trino.spi.exchange.ExchangeSourceHandle) TestingExchangeSourceHandle(io.trino.execution.scheduler.TestingExchange.TestingExchangeSourceHandle) SingleDistributionTaskSource(io.trino.execution.scheduler.StageTaskSourceFactory.SingleDistributionTaskSource) TestingExchangeSourceHandle(io.trino.execution.scheduler.TestingExchange.TestingExchangeSourceHandle) ArbitraryDistributionTaskSource(io.trino.execution.scheduler.StageTaskSourceFactory.ArbitraryDistributionTaskSource) SingleDistributionTaskSource(io.trino.execution.scheduler.StageTaskSourceFactory.SingleDistributionTaskSource) HashDistributionTaskSource(io.trino.execution.scheduler.StageTaskSourceFactory.HashDistributionTaskSource) SourceDistributionTaskSource(io.trino.execution.scheduler.StageTaskSourceFactory.SourceDistributionTaskSource) Test(org.testng.annotations.Test)

Aggregations

ArbitraryDistributionTaskSource (io.trino.execution.scheduler.StageTaskSourceFactory.ArbitraryDistributionTaskSource)1 HashDistributionTaskSource (io.trino.execution.scheduler.StageTaskSourceFactory.HashDistributionTaskSource)1 SingleDistributionTaskSource (io.trino.execution.scheduler.StageTaskSourceFactory.SingleDistributionTaskSource)1 SourceDistributionTaskSource (io.trino.execution.scheduler.StageTaskSourceFactory.SourceDistributionTaskSource)1 TestingExchangeSourceHandle (io.trino.execution.scheduler.TestingExchange.TestingExchangeSourceHandle)1 ExchangeSourceHandle (io.trino.spi.exchange.ExchangeSourceHandle)1 PlanNodeId (io.trino.sql.planner.plan.PlanNodeId)1 Test (org.testng.annotations.Test)1