Search in sources :

Example 76 with DictionaryBlock

use of com.facebook.presto.common.block.DictionaryBlock in project urban-eureka by errir503.

the class TestDictionaryAwarePageFilter method testDictionaryBlockProcessingWithUnusedFailure.

@Test
public void testDictionaryBlockProcessingWithUnusedFailure() {
    // match some
    testFilter(createDictionaryBlockWithUnusedEntries(20, 100), DictionaryBlock.class);
    // match none
    testFilter(createDictionaryBlockWithUnusedEntries(20, 0), DictionaryBlock.class);
    // match all
    testFilter(new DictionaryBlock(createLongsBlock(4, 5, -1), new int[100]), DictionaryBlock.class);
}
Also used : DictionaryBlock(com.facebook.presto.common.block.DictionaryBlock) Test(org.testng.annotations.Test)

Example 77 with DictionaryBlock

use of com.facebook.presto.common.block.DictionaryBlock in project urban-eureka by errir503.

the class TestDictionaryAwarePageProjection method createDictionaryBlock.

private static DictionaryBlock createDictionaryBlock(int dictionarySize, int blockSize) {
    Block dictionary = createLongSequenceBlock(0, dictionarySize);
    int[] ids = new int[blockSize];
    Arrays.setAll(ids, index -> index % dictionarySize);
    return new DictionaryBlock(dictionary, ids);
}
Also used : DictionaryBlock(com.facebook.presto.common.block.DictionaryBlock) RunLengthEncodedBlock(com.facebook.presto.common.block.RunLengthEncodedBlock) BlockAssertions.createLongSequenceBlock(com.facebook.presto.block.BlockAssertions.createLongSequenceBlock) LongArrayBlock(com.facebook.presto.common.block.LongArrayBlock) DictionaryBlock(com.facebook.presto.common.block.DictionaryBlock) Block(com.facebook.presto.common.block.Block) LazyBlock(com.facebook.presto.common.block.LazyBlock)

Example 78 with DictionaryBlock

use of com.facebook.presto.common.block.DictionaryBlock in project urban-eureka by errir503.

the class TestDictionaryAwarePageProjection method testDictionaryProcessingEnableDisable.

@Test(dataProvider = "forceYield")
public void testDictionaryProcessingEnableDisable(boolean forceYield) {
    DictionaryAwarePageProjection projection = createProjection();
    // function will always processes the first dictionary
    DictionaryBlock ineffectiveBlock = createDictionaryBlock(100, 20);
    testProjectRange(ineffectiveBlock, DictionaryBlock.class, projection, forceYield);
    testProjectFastReturnIgnoreYield(ineffectiveBlock, projection);
    // 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);
    // last dictionary not effective, so dictionary processing is disabled
    DictionaryBlock effectiveBlock = createDictionaryBlock(10, 100);
    testProjectRange(effectiveBlock, LongArrayBlock.class, projection, forceYield);
    testProjectList(effectiveBlock, LongArrayBlock.class, projection, forceYield);
    // last dictionary effective, so dictionary processing is enabled again
    testProjectRange(ineffectiveBlock, DictionaryBlock.class, projection, forceYield);
    testProjectFastReturnIgnoreYield(ineffectiveBlock, projection);
    // 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);
    // last dictionary not effective, so dictionary processing is disabled again
    testProjectRange(effectiveBlock, LongArrayBlock.class, projection, forceYield);
    testProjectList(effectiveBlock, LongArrayBlock.class, projection, forceYield);
}
Also used : DictionaryBlock(com.facebook.presto.common.block.DictionaryBlock) Test(org.testng.annotations.Test)

Example 79 with DictionaryBlock

use of com.facebook.presto.common.block.DictionaryBlock in project urban-eureka by errir503.

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);
}
Also used : DictionaryBlock(com.facebook.presto.common.block.DictionaryBlock) RunLengthEncodedBlock(com.facebook.presto.common.block.RunLengthEncodedBlock) BlockAssertions.createLongSequenceBlock(com.facebook.presto.block.BlockAssertions.createLongSequenceBlock) LongArrayBlock(com.facebook.presto.common.block.LongArrayBlock) DictionaryBlock(com.facebook.presto.common.block.DictionaryBlock) Block(com.facebook.presto.common.block.Block) LazyBlock(com.facebook.presto.common.block.LazyBlock)

Example 80 with DictionaryBlock

use of com.facebook.presto.common.block.DictionaryBlock in project urban-eureka by errir503.

the class TestDictionaryAwarePageProjection method testDictionaryBlock.

@Test(dataProvider = "forceYield")
public void testDictionaryBlock(boolean forceYield) {
    DictionaryBlock block = createDictionaryBlock(10, 100);
    testProject(block, DictionaryBlock.class, forceYield);
}
Also used : DictionaryBlock(com.facebook.presto.common.block.DictionaryBlock) Test(org.testng.annotations.Test)

Aggregations

DictionaryBlock (com.facebook.presto.common.block.DictionaryBlock)125 Test (org.testng.annotations.Test)66 Block (com.facebook.presto.common.block.Block)65 BlockAssertions.createRandomDictionaryBlock (com.facebook.presto.block.BlockAssertions.createRandomDictionaryBlock)32 RunLengthEncodedBlock (com.facebook.presto.common.block.RunLengthEncodedBlock)28 Slice (io.airlift.slice.Slice)26 Page (com.facebook.presto.common.Page)25 BlockBuilder (com.facebook.presto.common.block.BlockBuilder)22 Slices.utf8Slice (io.airlift.slice.Slices.utf8Slice)22 BlockAssertions.createLongSequenceBlock (com.facebook.presto.block.BlockAssertions.createLongSequenceBlock)14 LongArrayBlock (com.facebook.presto.common.block.LongArrayBlock)14 DictionaryId (com.facebook.presto.common.block.DictionaryId)12 LazyBlock (com.facebook.presto.common.block.LazyBlock)12 BlockAssertions.createLongsBlock (com.facebook.presto.block.BlockAssertions.createLongsBlock)10 BlockAssertions.createRLEBlock (com.facebook.presto.block.BlockAssertions.createRLEBlock)10 BlockAssertions.createRandomLongsBlock (com.facebook.presto.block.BlockAssertions.createRandomLongsBlock)10 BlockAssertions.createSlicesBlock (com.facebook.presto.block.BlockAssertions.createSlicesBlock)10 DictionaryId.randomDictionaryId (com.facebook.presto.common.block.DictionaryId.randomDictionaryId)10 IntArrayBlock (com.facebook.presto.common.block.IntArrayBlock)8 Type (com.facebook.presto.common.type.Type)8