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");
}
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);
}
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);
}
}
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);
}
}
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);
}
Aggregations