Search in sources :

Example 16 with RunLengthEncodedBlock

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));
}
Also used : Page(io.prestosql.spi.Page) RunLengthEncodedBlock(io.prestosql.spi.block.RunLengthEncodedBlock) BlockBuilder(io.prestosql.spi.block.BlockBuilder)

Example 17 with RunLengthEncodedBlock

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);
}
Also used : DoubleVec(nova.hetu.omniruntime.vector.DoubleVec) DoubleArrayOmniBlock(nova.hetu.olk.block.DoubleArrayOmniBlock) ArrayList(java.util.ArrayList) RunLengthEncodedBlock(io.prestosql.spi.block.RunLengthEncodedBlock) IntArrayOmniBlock(nova.hetu.olk.block.IntArrayOmniBlock) ByteArrayOmniBlock(nova.hetu.olk.block.ByteArrayOmniBlock) DictionaryOmniBlock(nova.hetu.olk.block.DictionaryOmniBlock) LazyBlock(io.prestosql.spi.block.LazyBlock) LazyOmniBlock(nova.hetu.olk.block.LazyOmniBlock) VariableWidthOmniBlock(nova.hetu.olk.block.VariableWidthOmniBlock) DoubleArrayOmniBlock(nova.hetu.olk.block.DoubleArrayOmniBlock) RowOmniBlock(nova.hetu.olk.block.RowOmniBlock) Int128ArrayOmniBlock(nova.hetu.olk.block.Int128ArrayOmniBlock) Block(io.prestosql.spi.block.Block) LongArrayOmniBlock(nova.hetu.olk.block.LongArrayOmniBlock) RowBlock(io.prestosql.spi.block.RowBlock) OperatorUtils.transferToOnHeapPage(nova.hetu.olk.tool.OperatorUtils.transferToOnHeapPage) Page(io.prestosql.spi.Page) RunLengthEncodedBlock(io.prestosql.spi.block.RunLengthEncodedBlock) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 18 with RunLengthEncodedBlock

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);
}
Also used : RunLengthEncodedBlock(io.prestosql.spi.block.RunLengthEncodedBlock) Block(io.prestosql.spi.block.Block) RowBlock(io.prestosql.spi.block.RowBlock) Page(io.prestosql.spi.Page) RunLengthEncodedBlock(io.prestosql.spi.block.RunLengthEncodedBlock)

Example 19 with RunLengthEncodedBlock

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));
}
Also used : Page(io.prestosql.spi.Page) RunLengthEncodedBlock(io.prestosql.spi.block.RunLengthEncodedBlock) BlockBuilder(io.prestosql.spi.block.BlockBuilder)

Example 20 with RunLengthEncodedBlock

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;
}
Also used : VariableWidthBlock(io.prestosql.spi.block.VariableWidthBlock) RunLengthEncodedBlock(io.prestosql.spi.block.RunLengthEncodedBlock) Block(io.prestosql.spi.block.Block) RunLengthEncodedBlock(io.prestosql.spi.block.RunLengthEncodedBlock) VariableWidthBlock(io.prestosql.spi.block.VariableWidthBlock)

Aggregations

RunLengthEncodedBlock (io.prestosql.spi.block.RunLengthEncodedBlock)37 Block (io.prestosql.spi.block.Block)24 Page (io.prestosql.spi.Page)17 Test (org.testng.annotations.Test)9 BlockBuilder (io.prestosql.spi.block.BlockBuilder)8 PrestoException (io.prestosql.spi.PrestoException)6 LazyBlock (io.prestosql.spi.block.LazyBlock)6 RowBlock (io.prestosql.spi.block.RowBlock)6 IOException (java.io.IOException)6 Slice (io.airlift.slice.Slice)5 LongArrayBlock (io.prestosql.spi.block.LongArrayBlock)4 UncheckedIOException (java.io.UncheckedIOException)4 DictionaryBlock (io.prestosql.spi.block.DictionaryBlock)3 BlockAssertions.createLongSequenceBlock (io.prestosql.block.BlockAssertions.createLongSequenceBlock)2 DriverYieldSignal (io.prestosql.operator.DriverYieldSignal)2 PageProcessor (io.prestosql.operator.project.PageProcessor)2 RcFileCorruptionException (io.prestosql.rcfile.RcFileCorruptionException)2 RowBlockBuilder (io.prestosql.spi.block.RowBlockBuilder)2 Type (io.prestosql.spi.type.Type)2 ByteArrayOmniBlock (nova.hetu.olk.block.ByteArrayOmniBlock)2