use of com.facebook.presto.common.block.DictionaryBlock in project urban-eureka by errir503.
the class TestDictionaryAwarePageProjection method testDictionaryBlockWithFailure.
@Test(dataProvider = "forceYield")
public void testDictionaryBlockWithFailure(boolean forceYield) {
DictionaryBlock block = createDictionaryBlockWithFailure(10, 100);
testProjectFails(block, DictionaryBlock.class, forceYield);
}
use of com.facebook.presto.common.block.DictionaryBlock in project urban-eureka by errir503.
the class TestDictionaryAwarePageProjection method createDictionaryBlockWithUnusedEntries.
private static DictionaryBlock createDictionaryBlockWithUnusedEntries(int dictionarySize, int blockSize) {
Block dictionary = createLongSequenceBlock(-10, dictionarySize);
int[] ids = new int[blockSize];
Arrays.setAll(ids, index -> (index % dictionarySize) + 10);
return new DictionaryBlock(dictionary, ids);
}
use of com.facebook.presto.common.block.DictionaryBlock in project urban-eureka by errir503.
the class TestDictionaryAwarePageProjection method testDictionaryBlockProcessingWithUnusedFailure.
@Test(dataProvider = "forceYield")
public void testDictionaryBlockProcessingWithUnusedFailure(boolean forceYield) {
DictionaryBlock block = createDictionaryBlockWithUnusedEntries(10, 100);
// failures in the dictionary processing will cause a fallback to normal columnar processing
testProject(block, LongArrayBlock.class, forceYield);
}
use of com.facebook.presto.common.block.DictionaryBlock in project urban-eureka by errir503.
the class TestDictionaryAwarePageProjection method testDictionaryProcessingIgnoreYield.
@Test
public void testDictionaryProcessingIgnoreYield() {
DictionaryAwarePageProjection projection = createProjection();
// the same input block will bypass yield with multiple projections
DictionaryBlock block = createDictionaryBlock(10, 100);
testProjectRange(block, DictionaryBlock.class, projection, true);
testProjectFastReturnIgnoreYield(block, projection);
testProjectFastReturnIgnoreYield(block, projection);
testProjectFastReturnIgnoreYield(block, projection);
}
use of com.facebook.presto.common.block.DictionaryBlock in project urban-eureka by errir503.
the class TestMinMaxByAggregation method testLongAndBlockPositionValueStateSerialization.
@Test
public void testLongAndBlockPositionValueStateSerialization() {
Type mapType = mapType(VARCHAR, BOOLEAN);
Map<String, Type> fieldMap = ImmutableMap.of("Key", BIGINT, "Value", mapType);
AccumulatorStateFactory<LongAndBlockPositionValueState> factory = StateCompiler.generateStateFactory(LongAndBlockPositionValueState.class, fieldMap, new DynamicClassLoader(LongAndBlockPositionValueState.class.getClassLoader()));
KeyAndBlockPositionValueStateSerializer<LongAndBlockPositionValueState> serializer = new LongAndBlockPositionStateSerializer(BIGINT, mapType);
LongAndBlockPositionValueState singleState = factory.createSingleState();
LongAndBlockPositionValueState deserializedState = factory.createSingleState();
singleState.setFirst(2020);
singleState.setFirstNull(false);
BlockBuilder builder = RowType.anonymous(ImmutableList.of(BOOLEAN, BOOLEAN, BIGINT, mapType)).createBlockBuilder(null, 1);
serializer.serialize(singleState, builder);
Block rowBlock = builder.build();
DictionaryBlock dictionaryBlock = (DictionaryBlock) rowBlock.getPositions(new int[] { 0 }, 0, 1);
serializer.deserialize(dictionaryBlock, 0, deserializedState);
assertEquals(deserializedState.isFirstNull(), singleState.isFirstNull());
assertEquals(deserializedState.getFirst(), singleState.getFirst());
}
Aggregations