use of io.prestosql.spi.block.RunLengthEncodedBlock in project boostkit-bigdata by kunpengcompute.
the class TestOrcDeletedRows method createTestPage.
private Page createTestPage(int originalTransactionStart, int originalTransactionEnd) {
int size = originalTransactionEnd - originalTransactionStart;
BlockBuilder originalTransaction = BIGINT.createFixedSizeBlockBuilder(size);
for (long i = originalTransactionStart; i < originalTransactionEnd; i++) {
originalTransaction.writeLong(i);
}
return new Page(size, originalTransaction.build(), new RunLengthEncodedBlock(bucketBlock, size), new RunLengthEncodedBlock(rowIdBlock, size));
}
use of io.prestosql.spi.block.RunLengthEncodedBlock in project boostkit-bigdata by kunpengcompute.
the class TestOperatorUtils method testRunLengthEncodedBlockTransfer.
@Test
public void testRunLengthEncodedBlockTransfer() {
List<Page> pages = buildPages(types, false, 1);
List<Page> runLengthEncodedPages = new ArrayList<>();
for (int i = 0; i < pages.size(); i++) {
Page page = pages.get(i);
List<Block> blocks = new ArrayList<>();
for (int j = 0; j < page.getBlocks().length; j++) {
blocks.add(new RunLengthEncodedBlock(page.getBlock(j), 1));
}
blocks.add(new DoubleArrayOmniBlock(1, new DoubleVec(1)));
blocks.add(lazyOmniBlock);
runLengthEncodedPages.add(new Page(blocks.toArray(new Block[blocks.size()])));
}
// transfer on-heap page to off-heap
List<Page> offHeapPages = transferToOffHeapPages(VecAllocator.GLOBAL_VECTOR_ALLOCATOR, runLengthEncodedPages);
// transfer off-heap page to on-heap
List<Page> onHeapPages = transferToOnHeapPages(offHeapPages);
freeNativeMemory(offHeapPages);
}
use of io.prestosql.spi.block.RunLengthEncodedBlock in project boostkit-bigdata by kunpengcompute.
the class HivePageSink method getDataPage.
private Page getDataPage(Page page) {
Block[] blocks = null;
if (HiveACIDWriteType.isRowIdNeeded(acidWriteType) && !isInsertOnlyTable()) {
// For UPDATE/DELETE source page will have extra block for row_id column.
blocks = new Block[dataColumnInputIndex.length + 1];
blocks[dataColumnInputIndex.length] = page.getBlock(rowIdColumnIndex);
} else {
blocks = new Block[dataColumnInputIndex.length];
}
for (int i = 0; i < dataColumnInputIndex.length; i++) {
if (acidWriteType == HiveACIDWriteType.DELETE) {
// For delete remaining data not required as these will be ignored during write.
// But this will reduce the data size of sort buffer
blocks[i] = new RunLengthEncodedBlock(nullBlocks.get(i), page.getPositionCount());
} else {
int dataColumn = dataColumnInputIndex[i];
blocks[i] = page.getBlock(dataColumn);
}
}
return new Page(page.getPositionCount(), blocks);
}
use of io.prestosql.spi.block.RunLengthEncodedBlock in project hetu-core by openlookeng.
the class TestOrcDeletedRows method createTestPage.
private Page createTestPage(int originalTransactionStart, int originalTransactionEnd) {
int size = originalTransactionEnd - originalTransactionStart;
BlockBuilder originalTransaction = BIGINT.createFixedSizeBlockBuilder(size);
for (long i = originalTransactionStart; i < originalTransactionEnd; i++) {
originalTransaction.writeLong(i);
}
return new Page(size, originalTransaction.build(), new RunLengthEncodedBlock(bucketBlock, size), new RunLengthEncodedBlock(rowIdBlock, size));
}
use of io.prestosql.spi.block.RunLengthEncodedBlock in project hetu-core by openlookeng.
the class SliceDirectSelectiveColumnReader method getBlock.
@Override
public Block getBlock(int[] positions, int positionCount) {
checkArgument(outputPositionCount > 0, "outputPositionCount must be greater than zero");
checkState(outputRequired, "This stream reader doesn't produce output");
checkState(positionCount <= outputPositionCount, "Not enough values");
checkState(!valuesInUse, "BlockLease hasn't been closed yet");
if (allNulls) {
return new RunLengthEncodedBlock(outputType.createBlockBuilder(null, 1).appendNull().build(), outputPositionCount);
}
boolean includeNulls = nullsAllowed && presentStream != null;
if (positionCount != outputPositionCount) {
compactValues(positions, positionCount, includeNulls);
}
Block block = new VariableWidthBlock(positionCount, dataAsSlice, offsets, Optional.ofNullable(includeNulls ? nulls : null));
dataAsSlice = null;
data = null;
offsets = null;
nulls = null;
return block;
}
Aggregations