Search in sources :

Example 1 with PartitioningSpillerFactory

use of io.trino.spiller.PartitioningSpillerFactory in project trino by trinodb.

the class TestHashJoinOperator method testInnerJoinWithFailingSpill.

@Test(dataProvider = "joinWithFailingSpillValues")
public void testInnerJoinWithFailingSpill(boolean probeHashEnabled, List<WhenSpill> whenSpill, WhenSpillFails whenSpillFails) {
    DummySpillerFactory buildSpillerFactory = new DummySpillerFactory();
    DummySpillerFactory joinSpillerFactory = new DummySpillerFactory();
    PartitioningSpillerFactory partitioningSpillerFactory = new GenericPartitioningSpillerFactory(joinSpillerFactory);
    String expectedMessage;
    switch(whenSpillFails) {
        case SPILL_BUILD:
            buildSpillerFactory.failSpill();
            expectedMessage = "Spill failed";
            break;
        case SPILL_JOIN:
            joinSpillerFactory.failSpill();
            expectedMessage = "Spill failed";
            break;
        case UNSPILL_BUILD:
            buildSpillerFactory.failUnspill();
            expectedMessage = "Unspill failed";
            break;
        case UNSPILL_JOIN:
            joinSpillerFactory.failUnspill();
            expectedMessage = "Unspill failed";
            break;
        default:
            throw new IllegalArgumentException(format("Unsupported option: %s", whenSpillFails));
    }
    assertThatThrownBy(() -> innerJoinWithSpill(probeHashEnabled, whenSpill, buildSpillerFactory, partitioningSpillerFactory)).isInstanceOf(RuntimeException.class).hasMessage(expectedMessage);
}
Also used : DummySpillerFactory(io.trino.operator.join.JoinTestUtils.DummySpillerFactory) GenericPartitioningSpillerFactory(io.trino.spiller.GenericPartitioningSpillerFactory) GenericPartitioningSpillerFactory(io.trino.spiller.GenericPartitioningSpillerFactory) PartitioningSpillerFactory(io.trino.spiller.PartitioningSpillerFactory) Test(org.testng.annotations.Test)

Aggregations

DummySpillerFactory (io.trino.operator.join.JoinTestUtils.DummySpillerFactory)1 GenericPartitioningSpillerFactory (io.trino.spiller.GenericPartitioningSpillerFactory)1 PartitioningSpillerFactory (io.trino.spiller.PartitioningSpillerFactory)1 Test (org.testng.annotations.Test)1