Examples of readBlock()


Examples of com.facebook.presto.spi.block.BlockEncoding.readBlock()

        Block expectedBlock = expectedBlockBuilder.build();

        BlockEncoding snappyEncoding = encoder.finish();
        assertTrue(encoderOutput.size() < expectedBlock.getSizeInBytes());

        Block actualBlock = snappyEncoding.readBlock(encoderOutput.slice().getInput());

        BlockAssertions.assertBlockEquals(actualBlock, expectedBlock);
    }
}
View Full Code Here

Examples of com.facebook.presto.spi.block.BlockEncoding.readBlock()

        @Override
        public DictionaryBlockEncoding readEncoding(TypeManager manager, BlockEncodingSerde serde, SliceInput input)
        {
            // read the dictionary
            BlockEncoding dictionaryEncoding = serde.readBlockEncoding(input);
            RandomAccessBlock dictionary = dictionaryEncoding.readBlock(input).toRandomAccessBlock();

            // read the id block encoding
            BlockEncoding idBlockEncoding = serde.readBlockEncoding(input);
            return new DictionaryBlockEncoding(dictionary, idBlockEncoding);
        }
View Full Code Here

Examples of com.facebook.presto.spi.block.BlockEncoding.readBlock()

        @Override
        public DictionaryBlockEncoding readEncoding(TypeManager manager, BlockEncodingSerde serde, SliceInput input)
        {
            // read the dictionary
            BlockEncoding dictionaryEncoding = serde.readBlockEncoding(input);
            Block dictionary = dictionaryEncoding.readBlock(input);

            // read the id block encoding
            BlockEncoding idBlockEncoding = serde.readBlockEncoding(input);
            return new DictionaryBlockEncoding(dictionary, idBlockEncoding);
        }
View Full Code Here

Examples of com.facebook.presto.spi.block.BlockEncoding.readBlock()

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

        Block block = blockEncoding.readBlock(sliceInput);
        assertInstanceOf(block, RunLengthEncodedBlock.class);
        RunLengthEncodedBlock rleBlock = (RunLengthEncodedBlock) block;
        assertTrue(positionEqualsPosition(VARCHAR, rleBlock, 0, expectedBlock, 0));
        assertEquals(rleBlock.getPositionCount(), 2);
        assertEquals(VARCHAR.getSlice(rleBlock, 0).toStringUtf8(), "alice");
View Full Code Here

Examples of com.facebook.presto.spi.block.BlockEncoding.readBlock()

        RunLengthEncodedBlock rleBlock = (RunLengthEncodedBlock) block;
        assertTrue(positionEqualsPosition(VARCHAR, rleBlock, 0, expectedBlock, 0));
        assertEquals(rleBlock.getPositionCount(), 2);
        assertEquals(VARCHAR.getSlice(rleBlock, 0).toStringUtf8(), "alice");

        block = blockEncoding.readBlock(sliceInput);
        assertInstanceOf(block, RunLengthEncodedBlock.class);
        rleBlock = (RunLengthEncodedBlock) block;
        assertTrue(positionEqualsPosition(VARCHAR, rleBlock, 0, expectedBlock, 2));
        assertEquals(rleBlock.getPositionCount(), 4);
        assertEquals(VARCHAR.getSlice(rleBlock, 0).toStringUtf8(), "bob");
View Full Code Here

Examples of com.facebook.presto.spi.block.BlockEncoding.readBlock()

        rleBlock = (RunLengthEncodedBlock) block;
        assertTrue(positionEqualsPosition(VARCHAR, rleBlock, 0, expectedBlock, 2));
        assertEquals(rleBlock.getPositionCount(), 4);
        assertEquals(VARCHAR.getSlice(rleBlock, 0).toStringUtf8(), "bob");

        block = blockEncoding.readBlock(sliceInput);
        assertInstanceOf(block, RunLengthEncodedBlock.class);
        rleBlock = (RunLengthEncodedBlock) block;
        assertTrue(positionEqualsPosition(VARCHAR, rleBlock, 0, expectedBlock, 6));
        assertEquals(rleBlock.getPositionCount(), 6);
        assertEquals(VARCHAR.getSlice(rleBlock, 0).toStringUtf8(), "charlie");
View Full Code Here

Examples of com.facebook.presto.spi.block.BlockEncoding.readBlock()

        Block expectedBlock = expectedBlockBuilder.build();

        DynamicSliceOutput sliceOutput = new DynamicSliceOutput(1024);
        BlockEncoding blockEncoding = new VariableWidthBlockEncoding();
        blockEncoding.writeBlock(sliceOutput, expectedBlock);
        Block actualBlock = blockEncoding.readBlock(sliceOutput.slice().getInput());
        BlockAssertions.assertBlockEquals(VARCHAR, actualBlock, expectedBlock);
    }

    @Test
    public void testCreateBlockWriter()
View Full Code Here

Examples of com.facebook.presto.spi.block.BlockEncoding.readBlock()

        VARCHAR.writeString(blockBuilder, "dave");
        Block block = blockBuilder.build();

        DynamicSliceOutput sliceOutput = new DynamicSliceOutput(1024);
        BlockEncoding blockEncoding = new UncompressedEncoder(VARCHAR, sliceOutput).append(block).append(block).finish();
        Block actualBlock = blockEncoding.readBlock(sliceOutput.slice().getInput());

        BlockBuilder expectedBlockBuilder = VARCHAR.createBlockBuilder(new BlockBuilderStatus());
        VARCHAR.writeString(expectedBlockBuilder, "alice");
        VARCHAR.writeString(expectedBlockBuilder, "bob");
        VARCHAR.writeString(expectedBlockBuilder, "charlie");
View Full Code Here

Examples of com.facebook.presto.spi.block.BlockEncoding.readBlock()

        VARCHAR.writeString(blockBuilder, "dave");
        Block block = blockBuilder.build();

        DynamicSliceOutput sliceOutput = new DynamicSliceOutput(1024);
        BlockEncoding blockEncoding = new DictionaryEncoder(VARCHAR, new UncompressedEncoder(VARCHAR, sliceOutput)).append(block).append(block).append(block).finish();
        Block actualBlock = blockEncoding.readBlock(sliceOutput.slice().getInput());

        BlockBuilder expectedBlockBuilder = VARCHAR.createBlockBuilder(new BlockBuilderStatus());
        VARCHAR.writeString(expectedBlockBuilder, "alice");
        VARCHAR.writeString(expectedBlockBuilder, "bob");
        VARCHAR.writeString(expectedBlockBuilder, "charlie");
View Full Code Here

Examples of com.facebook.presto.spi.block.BlockEncoding.readBlock()

        DynamicSliceOutput compressedOutput = new DynamicSliceOutput(1024);
        Encoder encoder = BlocksFileEncoding.SNAPPY.createBlocksWriter(VARCHAR, compressedOutput);

        encoder.append(block);
        BlockEncoding snappyEncoding = encoder.finish();
        Block actualBlock = snappyEncoding.readBlock(compressedOutput.slice().getInput());
        BlockAssertions.assertBlockEquals(VARCHAR, actualBlock, block);
    }

    @Test
    public void testLotsOfStuff()
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.