Search in sources :

Example 1 with BigintType

use of com.facebook.presto.spi.type.BigintType in project presto by prestodb.

the class TestLocalExchange method writeUnblockWhenAllReadersFinish.

@Test
public void writeUnblockWhenAllReadersFinish() {
    ImmutableList<BigintType> types = ImmutableList.of(BIGINT);
    LocalExchange exchange = new LocalExchange(FIXED_BROADCAST_DISTRIBUTION, 2, types, ImmutableList.of(), Optional.empty());
    assertEquals(exchange.getBufferCount(), 2);
    assertExchangeTotalBufferedBytes(exchange, 0);
    LocalExchangeSinkFactory sinkFactory = exchange.createSinkFactory();
    LocalExchangeSink sinkA = sinkFactory.createSink();
    assertSinkCanWrite(sinkA);
    LocalExchangeSink sinkB = sinkFactory.createSink();
    assertSinkCanWrite(sinkB);
    sinkFactory.close();
    sinkFactory.noMoreSinkFactories();
    LocalExchangeSource sourceA = exchange.getSource(0);
    assertSource(sourceA, 0);
    LocalExchangeSource sourceB = exchange.getSource(1);
    assertSource(sourceB, 0);
    sourceA.finish();
    assertSourceFinished(sourceA);
    assertSinkCanWrite(sinkA);
    assertSinkCanWrite(sinkB);
    sourceB.finish();
    assertSourceFinished(sourceB);
    assertSinkFinished(sinkA);
    assertSinkFinished(sinkB);
}
Also used : LocalExchangeSinkFactory(com.facebook.presto.operator.exchange.LocalExchange.LocalExchangeSinkFactory) BigintType(com.facebook.presto.spi.type.BigintType) Test(org.testng.annotations.Test)

Aggregations

LocalExchangeSinkFactory (com.facebook.presto.operator.exchange.LocalExchange.LocalExchangeSinkFactory)1 BigintType (com.facebook.presto.spi.type.BigintType)1 Test (org.testng.annotations.Test)1