Package com.facebook.presto.block.uncompressed

Examples of com.facebook.presto.block.uncompressed.UncompressedBlock


        public UncompressedBlock build()
        {
            checkState(!positionOffsets.isEmpty(), "Cannot build an empty block");

            return new UncompressedBlock(positionOffsets.size(), new TupleInfo(type), sliceOutput.slice());
        }
View Full Code Here


    }

    private void writeBlock()
    {
        Slice slice = buffer.slice();
        UncompressedBlock block = new UncompressedBlock(tupleCount, encoding.getTupleInfo(), slice);
        encoding.writeBlock(sliceOutput, block);
        buffer.reset();
        tupleCount = 0;
    }
View Full Code Here

    }

    @Override
    public void writeBlock(SliceOutput sliceOutput, Block block)
    {
        UncompressedBlock uncompressedBlock = (UncompressedBlock) block;
        Preconditions.checkArgument(block.getTupleInfo().equals(tupleInfo), "Invalid tuple info");
        writeUncompressedBlock(sliceOutput,
                uncompressedBlock.getPositionCount(),
                uncompressedBlock.getSlice());
    }
View Full Code Here

    {
        int blockSize = sliceInput.readInt();
        int tupleCount = sliceInput.readInt();

        Slice block = sliceInput.readSlice(blockSize);
        return new UncompressedBlock(tupleCount, tupleInfo, block);
    }
View Full Code Here

        checkState(!finishing, "Operator is finishing");
        checkState(channelSet != null, "Set has not been built yet");
        checkState(outputPage == null, "Operator still has pending output");

        // update hashing strategy to use probe block
        UncompressedBlock probeJoinBlock = (UncompressedBlock) page.getBlock(probeJoinChannel);
        channelSet.setLookupSlice(probeJoinBlock.getSlice());

        // create the block builder for the new boolean column
        // we know the exact size required for the block
        int blockSize = page.getPositionCount() * TupleInfo.SINGLE_BOOLEAN.getFixedSize();
        BlockBuilder blockBuilder = new BlockBuilder(TupleInfo.SINGLE_BOOLEAN, blockSize, Slices.allocate(blockSize).getOutput());

        BlockCursor probeJoinCursor = probeJoinBlock.cursor();
        for (int position = 0; position < page.getPositionCount(); position++) {
            checkState(probeJoinCursor.advanceNextPosition());
            if (probeJoinCursor.isNull(0)) {
                blockBuilder.appendNull();
            }
View Full Code Here

        private int addNewGroup(Slice groupBySlice, int rawOffset)
        {
            // copy group by tuple (key) to hash
            int length = groupByTupleInfo.size(groupBySlice, rawOffset);
            if (blockBuilder.writableBytes() < length) {
                UncompressedBlock block = blockBuilder.build();
                groupByBlocks.add(block);
                Slice slice = Slices.allocate(Math.max((int) BlockBuilder.DEFAULT_MAX_BLOCK_SIZE.toBytes(), length));
                blockBuilder = new BlockBuilder(groupByTupleInfo, slice.length(), slice.getOutput());
                hashStrategy.addSlice(slice);
            }
View Full Code Here

        public Iterator<Page> build()
        {
            // add the last block if it is not empty
            if (!blockBuilder.isEmpty()) {
                UncompressedBlock block = blockBuilder.build();
                groupByBlocks.add(block);
            }

            return Iterators.transform(groupByBlocks.iterator(), new Function<UncompressedBlock, Page>()
            {
View Full Code Here

    public UncompressedBlock build()
    {
        checkState(!tupleBuilder.isPartial(), "Tuple is not complete");
        checkState(!isEmpty(), "Cannot build an empty block");

        return new UncompressedBlock(count, tupleInfo, sliceOutput.slice());
    }
View Full Code Here

                        blocks = blockIterables.next().iterator();
                    }
                    if (blocks == null || !blocks.hasNext()) {
                        return endOfData();
                    }
                    UncompressedBlock block = (UncompressedBlock) blocks.next();
                    return block;
                }
            };
        }
View Full Code Here

        for (int i = 0; i < page.getChannelCount(); i++) {
            cursors[i] = page.getBlock(i).cursor();
        }

        // set hashing strategy to use probe block
        UncompressedBlock probeJoinBlock = (UncompressedBlock) page.getBlock(probeJoinChannel);
        hash.setProbeSlice(probeJoinBlock.getSlice());

        // initialize to invalid join position to force output code to advance the cursors
        joinPosition = -1;
    }
View Full Code Here

TOP

Related Classes of com.facebook.presto.block.uncompressed.UncompressedBlock

Copyright © 2018 www.massapicom. 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.