Package com.facebook.presto.spi.block

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


                BlockAssertions.createStringSequenceBlock(10, 20).toRandomAccessBlock(),
                BlockAssertions.createStringSequenceBlock(20, 30).toRandomAccessBlock(),
                BlockAssertions.createStringSequenceBlock(15, 25).toRandomAccessBlock());
        LongArrayList addresses = new LongArrayList();
        for (int blockIndex = 0; blockIndex < channel.size(); blockIndex++) {
            RandomAccessBlock block = channel.get(blockIndex);
            for (int positionIndex = 0; positionIndex < block.getPositionCount(); positionIndex++) {
                addresses.add(encodeSyntheticAddress(blockIndex, positionIndex));
            }
        }
        LookupSource lookupSource = lookupSourceFactoryFactory.createLookupSource(addresses, ImmutableList.of(channel), operatorContext);
View Full Code Here


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

                BlockCursor cursor = cursors[sortChannel];
                RandomAccessBlock currentMaxValue = currentMax[sortChannel];

                // compare the right value to the left cursor but negate the result since we are evaluating in the opposite order
                int compare = -currentMaxValue.compareTo(sortOrder, 0, cursor);
                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);

                RandomAccessBlock left = leftRow[channel];
                RandomAccessBlock 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<RandomAccessBlock> channel : channels) {
            RandomAccessBlock 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<RandomAccessBlock> channel : hashChannels) {
            RandomAccessBlock block = channel.get(blockIndex);
            result = result * 31 + block.hash(blockPosition);
        }
        return result;
    }
View Full Code Here

    @Override
    public boolean positionEqualsCursors(int blockIndex, int blockPosition, BlockCursor[] cursors)
    {
        for (int i = 0; i < hashChannels.size(); i++) {
            List<RandomAccessBlock> channel = hashChannels.get(i);
            RandomAccessBlock block = channel.get(blockIndex);
            if (!block.equalTo(blockPosition, cursors[i])) {
                return false;
            }
        }
        return true;
    }
View Full Code Here

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

        int rightBlockIndex = decodeSliceIndex(rightPageAddress);
        int rightBlockPosition = decodePosition(rightPageAddress);

        for (int i = 0; i < sortChannels.size(); i++) {
            int sortChannel = sortChannels.get(i);
            RandomAccessBlock leftBlock = pagesIndex.getChannel(sortChannel).get(leftBlockIndex);
            RandomAccessBlock rightBlock = pagesIndex.getChannel(sortChannel).get(rightBlockIndex);

            int compare = leftBlock.compareTo(sortOrders.get(i), leftBlockPosition, rightBlock, rightBlockPosition);
            if (compare != 0) {
                return compare;
            }
View Full Code Here

        positionCount += page.getPositionCount();

        int pageIndex = channels[0].size();
        RandomAccessPage randomAccessPage = page.toRandomAccessPage();
        for (int i = 0; i < channels.length; i++) {
            RandomAccessBlock block = randomAccessPage.getBlock(i);
            channels[i].add(block);
            pagesMemorySize += block.getSizeInBytes();
        }

        for (int position = 0; position < page.getPositionCount(); position++) {
            long sliceAddress = encodeSyntheticAddress(pageIndex, position);
            valueAddresses.add(sliceAddress);
View Full Code Here

            int blockPosition = decodePosition(pageAddress);

            // append the row
            for (int i = 0; i < outputChannels.length; i++) {
                int outputChannel = outputChannels[i];
                RandomAccessBlock block = this.channels[outputChannel].get(blockIndex);
                block.appendTo(blockPosition, pageBuilder.getBlockBuilder(i));
            }

            position++;
        }
View Full Code Here

TOP

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

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.