use of io.prestosql.spi.block.DictionaryBlock in project boostkit-bigdata by kunpengcompute.
the class OperatorUtils method buildDictionaryBlock.
private static Block buildDictionaryBlock(Block block, int positionCount) {
DictionaryVec dictionaryVec = (DictionaryVec) block.getValues();
int[] newIds = dictionaryVec.getIds(positionCount);
Block dictionary = buildOnHeapBlock(((DictionaryOmniBlock) block).getDictionary());
return new DictionaryBlock(dictionary, newIds);
}
use of io.prestosql.spi.block.DictionaryBlock in project boostkit-bigdata by kunpengcompute.
the class BlockUtil method createDoubleDictionaryBlock.
public static Block createDoubleDictionaryBlock(int start, int length) {
checkArgument(length > 5, "block must have more than 5 entries");
int dictionarySize = length / 5;
BlockBuilder builder = DOUBLE.createBlockBuilder(null, dictionarySize);
for (int i = start; i < start + dictionarySize; i++) {
DOUBLE.writeDouble(builder, i);
}
int[] ids = new int[length];
for (int i = 0; i < length; i++) {
ids[i] = i % dictionarySize;
}
return new DictionaryBlock(builder.build(), ids);
}
use of io.prestosql.spi.block.DictionaryBlock in project boostkit-bigdata by kunpengcompute.
the class BlockUtil method createRealDictionaryBlock.
public static Block createRealDictionaryBlock(int start, int length) {
checkArgument(length > 5, "block must have more than 5 entries");
int dictionarySize = length / 5;
BlockBuilder builder = REAL.createBlockBuilder(null, dictionarySize);
for (int i = start; i < start + dictionarySize; i++) {
REAL.writeLong(builder, i);
}
int[] ids = new int[length];
for (int i = 0; i < length; i++) {
ids[i] = i % dictionarySize;
}
return new DictionaryBlock(builder.build(), ids);
}
use of io.prestosql.spi.block.DictionaryBlock in project boostkit-bigdata by kunpengcompute.
the class BlockUtil method createBooleanDictionaryBlock.
public static Block createBooleanDictionaryBlock(int start, int length) {
checkArgument(length > 5, "block must have more than 5 entries");
int dictionarySize = length / 5;
BlockBuilder builder = BOOLEAN.createBlockBuilder(null, dictionarySize);
for (int i = start; i < start + dictionarySize; i++) {
BOOLEAN.writeBoolean(builder, i % 2 == 0);
}
int[] ids = new int[length];
for (int i = 0; i < length; i++) {
ids[i] = i % dictionarySize;
}
return new DictionaryBlock(builder.build(), ids);
}
use of io.prestosql.spi.block.DictionaryBlock in project boostkit-bigdata by kunpengcompute.
the class BlockUtil method createDateDictionaryBlock.
public static Block createDateDictionaryBlock(int start, int length) {
checkArgument(length > 5, "block must have more than 5 entries");
int dictionarySize = length / 5;
BlockBuilder builder = DATE.createBlockBuilder(null, dictionarySize);
for (int i = start; i < start + dictionarySize; i++) {
DATE.writeLong(builder, i);
}
int[] ids = new int[length];
for (int i = 0; i < length; i++) {
ids[i] = i % dictionarySize;
}
return new DictionaryBlock(builder.build(), ids);
}
Aggregations