use of com.facebook.presto.spi.block.SliceArrayBlock in project presto by prestodb.
the class TestSliceArrayBlock method testCopyPositions.
@Test
public void testCopyPositions() throws Exception {
Slice[] expectedValues = (Slice[]) alternatingNullValues(createExpectedValues(100));
SliceArrayBlock block = new SliceArrayBlock(expectedValues.length, expectedValues);
assertBlockFilteredPositions(expectedValues, block, Ints.asList(0, 2, 4, 6, 7, 9, 10, 16));
}
use of com.facebook.presto.spi.block.SliceArrayBlock in project presto by prestodb.
the class TestSliceArrayBlock method assertVariableWithValues.
private void assertVariableWithValues(Slice[] expectedValues) {
SliceArrayBlock block = new SliceArrayBlock(expectedValues.length, expectedValues);
assertBlock(block, expectedValues);
}
use of com.facebook.presto.spi.block.SliceArrayBlock in project presto by prestodb.
the class TestDictionaryBlock method createDictionaryBlock.
private static DictionaryBlock createDictionaryBlock(Slice[] expectedValues, int positionCount) {
int dictionarySize = expectedValues.length;
int[] ids = new int[positionCount];
for (int i = 0; i < positionCount; i++) {
ids[i] = i % dictionarySize;
}
return new DictionaryBlock(positionCount, new SliceArrayBlock(dictionarySize, expectedValues), ids);
}
use of com.facebook.presto.spi.block.SliceArrayBlock in project presto by prestodb.
the class TestDictionaryBlock method createDictionaryBlockWithUnreferencedKeys.
private static DictionaryBlock createDictionaryBlockWithUnreferencedKeys(Slice[] expectedValues, int positionCount) {
// adds references to 0 and all odd indexes
int dictionarySize = expectedValues.length;
int[] ids = new int[positionCount];
for (int i = 0; i < positionCount; i++) {
int index = i % dictionarySize;
if (index % 2 == 0 && index != 0) {
index--;
}
ids[i] = index;
}
return new DictionaryBlock(positionCount, new SliceArrayBlock(dictionarySize, expectedValues), ids);
}
use of com.facebook.presto.spi.block.SliceArrayBlock in project presto by prestodb.
the class TestPageProcessorCompiler method createDictionaryBlock.
private static DictionaryBlock createDictionaryBlock(Slice[] expectedValues, int positionCount) {
int dictionarySize = expectedValues.length;
int[] ids = new int[positionCount];
for (int i = 0; i < positionCount; i++) {
ids[i] = i % dictionarySize;
}
return new DictionaryBlock(positionCount, new SliceArrayBlock(dictionarySize, expectedValues), ids);
}
Aggregations