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(VARCHAR, actualBlock, expectedBlock);
    }
}
View Full Code Here

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

    private static Block copyBlock(Block block)
    {
        DynamicSliceOutput sliceOutput = new DynamicSliceOutput(1024);
        BlockEncoding blockEncoding = block.getEncoding();
        blockEncoding.writeBlock(sliceOutput, block);
        return blockEncoding.readBlock(sliceOutput.slice().getInput());
    }

    private static Block toSingeValuedBlock(Slice expectedValue)
    {
        BlockBuilder blockBuilder = VARBINARY.createBlockBuilder(new BlockBuilderStatus());
View Full Code Here

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

        DynamicSliceOutput sliceOutput = new DynamicSliceOutput(1024);
        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");
View Full Code Here

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

        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");
View Full Code Here

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

        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");
View Full Code Here

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

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

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

    @Test
    public void testLotsOfStuff()
View Full Code Here

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);
            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()

        Block block = createTestBlock();

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

    protected void assertPositionEquals(Block block, int position, Object value)
    {
View Full Code Here

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

                .build();

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

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