Search in sources :

Example 36 with RunLengthEncodedBlock

use of io.trino.spi.block.RunLengthEncodedBlock in project trino by trinodb.

the class TestDictionaryAwarePageFilter method testRleBlockWithFailure.

@Test
public void testRleBlockWithFailure() {
    DictionaryAwarePageFilter filter = createDictionaryAwarePageFilter(true, LongArrayBlock.class);
    RunLengthEncodedBlock fail = new RunLengthEncodedBlock(createLongSequenceBlock(-10, -9), 100);
    assertThatThrownBy(() -> testFilter(filter, fail, true)).isInstanceOf(NegativeValueException.class).hasMessage("value is negative: -10");
}
Also used : RunLengthEncodedBlock(io.trino.spi.block.RunLengthEncodedBlock) Test(org.testng.annotations.Test)

Example 37 with RunLengthEncodedBlock

use of io.trino.spi.block.RunLengthEncodedBlock in project trino by trinodb.

the class TestDictionaryAwarePageProjection method testRleBlock.

@Test(dataProvider = "forceYield")
public void testRleBlock(boolean forceYield, boolean produceLazyBlock) {
    Block value = createLongSequenceBlock(42, 43);
    RunLengthEncodedBlock block = new RunLengthEncodedBlock(value, 100);
    testProject(block, RunLengthEncodedBlock.class, forceYield, produceLazyBlock);
}
Also used : BlockAssertions.createLongSequenceBlock(io.trino.block.BlockAssertions.createLongSequenceBlock) DictionaryBlock(io.trino.spi.block.DictionaryBlock) LazyBlock(io.trino.spi.block.LazyBlock) Block(io.trino.spi.block.Block) LongArrayBlock(io.trino.spi.block.LongArrayBlock) RunLengthEncodedBlock(io.trino.spi.block.RunLengthEncodedBlock) BlockAssertions.createLongsBlock(io.trino.block.BlockAssertions.createLongsBlock) RunLengthEncodedBlock(io.trino.spi.block.RunLengthEncodedBlock) Test(org.testng.annotations.Test)

Example 38 with RunLengthEncodedBlock

use of io.trino.spi.block.RunLengthEncodedBlock in project trino by trinodb.

the class TestColumnarArray method assertRunLengthEncodedBlock.

private static <T> void assertRunLengthEncodedBlock(Block block, T[] expectedValues) {
    for (int position = 0; position < block.getPositionCount(); position++) {
        RunLengthEncodedBlock runLengthEncodedBlock = createTestRleBlock(block, position);
        T[] expectedDictionaryValues = createTestRleExpectedValues(expectedValues, position);
        assertBlock(runLengthEncodedBlock, expectedDictionaryValues);
        assertColumnarArray(runLengthEncodedBlock, expectedDictionaryValues);
    }
}
Also used : RunLengthEncodedBlock(io.trino.spi.block.RunLengthEncodedBlock)

Example 39 with RunLengthEncodedBlock

use of io.trino.spi.block.RunLengthEncodedBlock in project trino by trinodb.

the class TestColumnarMap method assertRunLengthEncodedBlock.

private static void assertRunLengthEncodedBlock(Block block, Slice[][][] expectedValues) {
    for (int position = 0; position < block.getPositionCount(); position++) {
        RunLengthEncodedBlock runLengthEncodedBlock = createTestRleBlock(block, position);
        Slice[][][] expectedDictionaryValues = createTestRleExpectedValues(expectedValues, position);
        assertBlock(runLengthEncodedBlock, expectedDictionaryValues);
        assertColumnarMap(runLengthEncodedBlock, expectedDictionaryValues);
    }
}
Also used : Slice(io.airlift.slice.Slice) RunLengthEncodedBlock(io.trino.spi.block.RunLengthEncodedBlock)

Example 40 with RunLengthEncodedBlock

use of io.trino.spi.block.RunLengthEncodedBlock in project trino by trinodb.

the class BlockAssertions method createRLEBlock.

public static RunLengthEncodedBlock createRLEBlock(double value, int positionCount) {
    BlockBuilder blockBuilder = DOUBLE.createBlockBuilder(null, 1);
    DOUBLE.writeDouble(blockBuilder, value);
    return new RunLengthEncodedBlock(blockBuilder.build(), positionCount);
}
Also used : RunLengthEncodedBlock(io.trino.spi.block.RunLengthEncodedBlock) BlockBuilder(io.trino.spi.block.BlockBuilder) RowBlockBuilder(io.trino.spi.block.RowBlockBuilder)

Aggregations

RunLengthEncodedBlock (io.trino.spi.block.RunLengthEncodedBlock)41 Block (io.trino.spi.block.Block)25 Page (io.trino.spi.Page)22 Test (org.testng.annotations.Test)13 DictionaryBlock (io.trino.spi.block.DictionaryBlock)8 TrinoException (io.trino.spi.TrinoException)6 BlockBuilder (io.trino.spi.block.BlockBuilder)6 Slice (io.airlift.slice.Slice)5 BlockAssertions.createLongsBlock (io.trino.block.BlockAssertions.createLongsBlock)5 LongArrayBlock (io.trino.spi.block.LongArrayBlock)5 BlockAssertions.createLongSequenceBlock (io.trino.block.BlockAssertions.createLongSequenceBlock)4 LazyBlock (io.trino.spi.block.LazyBlock)4 Type (io.trino.spi.type.Type)4 IOException (java.io.IOException)4 Utils.nativeValueToBlock (io.trino.spi.predicate.Utils.nativeValueToBlock)3 UncheckedIOException (java.io.UncheckedIOException)3 BlockAssertions.createStringSequenceBlock (io.trino.block.BlockAssertions.createStringSequenceBlock)2 PageSplitterUtil.splitPage (io.trino.execution.buffer.PageSplitterUtil.splitPage)2 DriverYieldSignal (io.trino.operator.DriverYieldSignal)2 PageProcessor (io.trino.operator.project.PageProcessor)2