use of io.trino.spi.block.DictionaryBlock in project trino by trinodb.
the class TestDictionaryAwarePageFilter method createDictionaryBlockWithFailure.
private static DictionaryBlock createDictionaryBlockWithFailure(int dictionarySize, int blockSize) {
Block dictionary = createLongSequenceBlock(-10, dictionarySize - 10);
int[] ids = new int[blockSize];
Arrays.setAll(ids, index -> index % dictionarySize);
return new DictionaryBlock(dictionary, ids);
}
use of io.trino.spi.block.DictionaryBlock in project trino by trinodb.
the class TestDictionaryAwarePageFilter method testDictionaryProcessingEnableDisable.
@Test
public void testDictionaryProcessingEnableDisable() {
TestDictionaryFilter nestedFilter = new TestDictionaryFilter(true);
DictionaryAwarePageFilter filter = new DictionaryAwarePageFilter(nestedFilter);
DictionaryBlock ineffectiveBlock = createDictionaryBlock(100, 20);
DictionaryBlock effectiveBlock = createDictionaryBlock(10, 100);
// function will always processes the first dictionary
nestedFilter.setExpectedType(LongArrayBlock.class);
testFilter(filter, ineffectiveBlock, true);
// last dictionary not effective, so dictionary processing is disabled
nestedFilter.setExpectedType(DictionaryBlock.class);
testFilter(filter, effectiveBlock, true);
// last dictionary not effective, so dictionary processing is enabled again
nestedFilter.setExpectedType(LongArrayBlock.class);
testFilter(filter, ineffectiveBlock, true);
// last dictionary not effective, so dictionary processing is disabled again
nestedFilter.setExpectedType(DictionaryBlock.class);
testFilter(filter, effectiveBlock, true);
}
use of io.trino.spi.block.DictionaryBlock in project trino by trinodb.
the class TestDictionaryAwarePageProjection method testDictionaryProcessingEnableDisable.
@Test(dataProvider = "forceYield")
public void testDictionaryProcessingEnableDisable(boolean forceYield, boolean produceLazyBlock) {
DictionaryAwarePageProjection projection = createProjection(produceLazyBlock);
// function will always processes the first dictionary
DictionaryBlock ineffectiveBlock = createDictionaryBlock(100, 20);
testProjectRange(ineffectiveBlock, DictionaryBlock.class, projection, forceYield, produceLazyBlock);
testProjectFastReturnIgnoreYield(ineffectiveBlock, projection, produceLazyBlock);
// dictionary processing can reuse the last dictionary
// in this case, we don't even check yield signal; make yieldForce to false
testProjectList(ineffectiveBlock, DictionaryBlock.class, projection, false, produceLazyBlock);
// last dictionary not effective, so dictionary processing is disabled
DictionaryBlock effectiveBlock = createDictionaryBlock(10, 100);
testProjectRange(effectiveBlock, LongArrayBlock.class, projection, forceYield, produceLazyBlock);
testProjectList(effectiveBlock, LongArrayBlock.class, projection, forceYield, produceLazyBlock);
// last dictionary effective, so dictionary processing is enabled again
testProjectRange(ineffectiveBlock, DictionaryBlock.class, projection, forceYield, produceLazyBlock);
testProjectFastReturnIgnoreYield(ineffectiveBlock, projection, produceLazyBlock);
// dictionary processing can reuse the last dictionary
// in this case, we don't even check yield signal; make yieldForce to false
testProjectList(ineffectiveBlock, DictionaryBlock.class, projection, false, produceLazyBlock);
// last dictionary not effective, so dictionary processing is disabled again
testProjectRange(effectiveBlock, LongArrayBlock.class, projection, forceYield, produceLazyBlock);
testProjectList(effectiveBlock, LongArrayBlock.class, projection, forceYield, produceLazyBlock);
}
use of io.trino.spi.block.DictionaryBlock in project trino by trinodb.
the class TestDictionaryAwarePageProjection method testDictionaryBlockWithFailure.
@Test(dataProvider = "forceYield")
public void testDictionaryBlockWithFailure(boolean forceYield, boolean produceLazyBlock) {
DictionaryBlock block = createDictionaryBlockWithFailure(10, 100);
testProjectFails(block, DictionaryBlock.class, forceYield, produceLazyBlock);
}
use of io.trino.spi.block.DictionaryBlock in project trino by trinodb.
the class TestDictionaryAwarePageProjection method createDictionaryBlockWithFailure.
private static DictionaryBlock createDictionaryBlockWithFailure(int dictionarySize, int blockSize) {
Block dictionary = createLongSequenceBlock(-10, dictionarySize - 10);
int[] ids = new int[blockSize];
Arrays.setAll(ids, index -> index % dictionarySize);
return new DictionaryBlock(dictionary, ids);
}
Aggregations