Package com.facebook.presto.spi.block

Examples of com.facebook.presto.spi.block.Block


        }

        public boolean equals(int thisPosition, int thatPosition, Block[] thatBlocks, int[] channels)
        {
            for (int i = 0; i < channels.length; i++) {
                Block thisBlock = blockBuilders.get(i);
                Block thatBlock = thatBlocks[channels[i]];
                if (!thisBlock.equalTo(thisPosition, thatBlock, thatPosition)) {
                    return false;
                }
            }
            return true;
View Full Code Here


        {
            int channel = node.getChannel();
            if (context instanceof PagePositionContext) {
                PagePositionContext pagePositionContext = (PagePositionContext) context;
                int position = pagePositionContext.getPosition();
                Block block = pagePositionContext.getBlock(channel);

                if (block.isNull(position)) {
                    return null;
                }

                Class<?> javaType = block.getType().getJavaType();
                if (javaType == boolean.class) {
                    return block.getBoolean(position);
                }
                else if (javaType == long.class) {
                    return block.getLong(position);
                }
                else if (javaType == double.class) {
                    return block.getDouble(position);
                }
                else if (javaType == Slice.class) {
                    return block.getSlice(position);
                }
                else {
                    throw new UnsupportedOperationException("not yet implemented");
                }
            }
View Full Code Here

    @Override
    public void appendTo(PageBuilder pageBuilder)
    {
        for (int outputIndex = 0; outputIndex < blocks.length; outputIndex++) {
            Block block = blocks[outputIndex];
            block.appendTo(position, pageBuilder.getBlockBuilder(outputIndex));
        }
    }
View Full Code Here

        {
            for (int i = 0; i < sortChannels.size(); i++) {
                int sortChannel = sortChannels.get(i);
                SortOrder sortOrder = sortOrders.get(i);

                Block block = blocks[sortChannel];
                Block currentMaxValue = currentMax[sortChannel];

                // compare the right value to the left block but negate the result since we are evaluating in the opposite order
                int compare = -currentMaxValue.compareTo(sortOrder, 0, block, position);
                if (compare != 0) {
                    return compare;
                }
            }
            return 0;
View Full Code Here

        {
            for (int index = 0; index < sortChannels.size(); index++) {
                int channel = sortChannels.get(index);
                SortOrder sortOrder = sortOrders.get(index);

                Block left = leftRow[channel];
                Block right = rightRow[channel];

                int comparison = left.compareTo(sortOrder, 0, right, 0);
                if (comparison != 0) {
                    return comparison;
                }
View Full Code Here

    @Override
    public void appendTo(int blockIndex, int blockPosition, PageBuilder pageBuilder, int outputChannelOffset)
    {
        for (List<Block> channel : channels) {
            Block block = channel.get(blockIndex);
            block.appendTo(blockPosition, pageBuilder.getBlockBuilder(outputChannelOffset));
            outputChannelOffset++;
        }
    }
View Full Code Here

    @Override
    public int hashPosition(int blockIndex, int blockPosition)
    {
        int result = 0;
        for (List<Block> channel : hashChannels) {
            Block block = channel.get(blockIndex);
            result = result * 31 + block.hash(blockPosition);
        }
        return result;
    }
View Full Code Here

    @Override
    public boolean positionEqualsRow(int leftBlockIndex, int leftBlockPosition, int rightPosition, Block[] rightBlocks)
    {
        for (int i = 0; i < hashChannels.size(); i++) {
            List<Block> channel = hashChannels.get(i);
            Block block = channel.get(leftBlockIndex);
            if (!block.equalTo(leftBlockPosition, rightBlocks[i], rightPosition)) {
                return false;
            }
        }
        return true;
    }
View Full Code Here

    @Override
    public boolean positionEqualsPosition(int leftBlockIndex, int leftBlockPosition, int rightBlockIndex, int rightBlockPosition)
    {
        for (List<Block> channel : hashChannels) {
            Block leftBlock = channel.get(leftBlockIndex);
            Block rightBlock = channel.get(rightBlockIndex);
            if (!leftBlock.equalTo(leftBlockPosition, rightBlock, rightBlockPosition)) {
                return false;
            }
        }
View Full Code Here

        private static final Slice MAX_SHIP_DATE = Slices.copiedBuffer("1995-01-01", UTF_8);

        @Override
        public int process(ConnectorSession session, Page page, int start, int end, PageBuilder pageBuilder)
        {
            Block discountBlock = page.getBlock(1);
            int position = start;
            for (; position < end; position++) {
                // where shipdate >= '1994-01-01'
                //    and shipdate < '1995-01-01'
                //    and discount >= 0.05
View Full Code Here

TOP

Related Classes of com.facebook.presto.spi.block.Block

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.