Examples of RunLengthEncodedBlock


Examples of com.facebook.presto.block.rle.RunLengthEncodedBlock

        Block nullValueBlock = parameterTypes.get(0).createBlockBuilder(new BlockBuilderStatus())
                .appendNull()
                .build();

        Block block = new RunLengthEncodedBlock(nullValueBlock, 10);
        testAggregation(getExpectedValueIncludingNulls(0, 0, 10), block);
    }
View Full Code Here

Examples of com.facebook.presto.block.rle.RunLengthEncodedBlock

    {
        Block value = BOOLEAN.createBlockBuilder(new BlockBuilderStatus())
                .appendNull()
                .build();

        return new RunLengthEncodedBlock(value, positionCount);
    }
View Full Code Here

Examples of com.facebook.presto.block.rle.RunLengthEncodedBlock

    private static RunLengthEncodedBlock createRLEBlock(double percentile, int positionCount)
    {
        BlockBuilder blockBuilder = DOUBLE.createBlockBuilder(new BlockBuilderStatus());
        DOUBLE.writeDouble(blockBuilder, percentile);
        return new RunLengthEncodedBlock(blockBuilder.build(), positionCount);
    }
View Full Code Here

Examples of com.facebook.presto.block.rle.RunLengthEncodedBlock

                newPages[i] = page;
            }
            else {
                Block[] newBlocks = new Block[page.getChannelCount() + offset];
                for (int channel = 0; channel < offset; channel++) {
                    newBlocks[channel] = new RunLengthEncodedBlock(NULL_BOOLEAN_TUPLE, page.getPositionCount());
                }
                for (int channel = 0; channel < page.getBlocks().length; channel++) {
                    newBlocks[channel + offset] = page.getBlocks()[channel];
                }
                newPages[i] = new Page(page.getPositionCount(), newBlocks);
View Full Code Here

Examples of com.facebook.presto.block.rle.RunLengthEncodedBlock

        return this;
    }

    private void writeBlock()
    {
        RunLengthEncodedBlock block = new RunLengthEncodedBlock(lastValue, positionCount);

        encoding.writeBlock(sliceOutput, block);
        lastValue = null;
        positionCount = 0;
    }
View Full Code Here

Examples of com.facebook.presto.block.rle.RunLengthEncodedBlock

    {
        Block value = VARCHAR.createBlockBuilder(new BlockBuilderStatus())
                .appendSlice(Slices.utf8Slice("alice"))
                .build();

        RunLengthEncodedBlock expectedBlock = new RunLengthEncodedBlock(value, 11);

        DynamicSliceOutput sliceOutput = new DynamicSliceOutput(1024);
        RunLengthBlockEncoding blockEncoding = new RunLengthBlockEncoding(new VariableWidthBlockEncoding(VARCHAR));
        blockEncoding.writeBlock(sliceOutput, expectedBlock);
        RunLengthEncodedBlock actualBlock = blockEncoding.readBlock(sliceOutput.slice().getInput());
        assertTrue(actualBlock.equalTo(0, expectedBlock, 0));
        BlockAssertions.assertBlockEquals(actualBlock, expectedBlock);
    }
View Full Code Here

Examples of com.facebook.presto.block.rle.RunLengthEncodedBlock

        BlockEncoding blockEncoding = new RunLengthEncoder(sliceOutput).append(expectedBlock).finish();
        SliceInput sliceInput = sliceOutput.slice().getInput();

        Block block = blockEncoding.readBlock(sliceInput);
        assertInstanceOf(block, RunLengthEncodedBlock.class);
        RunLengthEncodedBlock rleBlock = (RunLengthEncodedBlock) block;
        assertTrue(rleBlock.equalTo(0, expectedBlock, 0));
        assertEquals(rleBlock.getPositionCount(), 2);
        assertEquals(rleBlock.getSlice(0).toStringUtf8(), "alice");

        block = blockEncoding.readBlock(sliceInput);
        assertInstanceOf(block, RunLengthEncodedBlock.class);
        rleBlock = (RunLengthEncodedBlock) block;
        assertTrue(rleBlock.equalTo(0, expectedBlock, 2));
        assertEquals(rleBlock.getPositionCount(), 4);
        assertEquals(rleBlock.getSlice(0).toStringUtf8(), "bob");

        block = blockEncoding.readBlock(sliceInput);
        assertInstanceOf(block, RunLengthEncodedBlock.class);
        rleBlock = (RunLengthEncodedBlock) block;
        assertTrue(rleBlock.equalTo(0, expectedBlock, 6));
        assertEquals(rleBlock.getPositionCount(), 6);
        assertEquals(rleBlock.getSlice(0).toStringUtf8(), "charlie");

        assertFalse(sliceInput.isReadable());
    }
View Full Code Here

Examples of com.facebook.presto.block.rle.RunLengthEncodedBlock

        return this;
    }

    private void writeBlock()
    {
        RunLengthEncodedBlock block = new RunLengthEncodedBlock(lastValue, positionCount);

        encoding.writeBlock(sliceOutput, block);
        lastValue = null;
        positionCount = 0;
    }
View Full Code Here

Examples of com.facebook.presto.block.rle.RunLengthEncodedBlock

    @Override
    public void testAllPositionsNull()
            throws Exception
    {
        Block nullsBlock = new RunLengthEncodedBlock(nullTuple(getSequenceBlock(0, 10).getTupleInfo()), 11);
        testMultiplePositions(nullsBlock, 10L, 10);
    }
View Full Code Here

Examples of com.facebook.presto.block.rle.RunLengthEncodedBlock

    @Override
    public void testVectorAllPositionsNull()
            throws Exception
    {
        Block nullsBlock = new RunLengthEncodedBlock(nullTuple(getSequenceBlock(0, 10).getTupleInfo()), 10);
        testVectorMultiplePositions(nullsBlock, 10L);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.