Package com.facebook.presto.spi.block

Examples of com.facebook.presto.spi.block.BlockCursor.advanceNextPosition()


        if (encoding == null) {
            encoding = new SnappyBlockEncoding(block.getType(), block.getEncoding());
            blockBuilder = block.getType().createBlockBuilder(new BlockBuilderStatus());
        }
        BlockCursor cursor = block.cursor();
        while (cursor.advanceNextPosition()) {
            cursor.appendTo(blockBuilder);
            if (blockBuilder.isFull()) {
                flushBlock();
            }
        }
View Full Code Here


            dictionaryBuilder = new DictionaryBuilder(type);
        }

        BlockCursor cursor = block.cursor();
        BlockBuilder idBlockBuilder = BIGINT.createBlockBuilder(new BlockBuilderStatus());
        while (cursor.advanceNextPosition()) {
            int key = dictionaryBuilder.putIfAbsent(cursor);
            idBlockBuilder.appendLong(key);
        }
        idWriter.append(idBlockBuilder.build());
View Full Code Here

        int rows = 0;
        for (int position = 0; position < page.getPositionCount(); position++) {
            long sampleWeight = 1;
            if (sampleWeightCursor != null) {
                checkArgument(sampleWeightCursor.advanceNextPosition());
                sampleWeight = sampleWeightCursor.getLong();
            }
            rows += sampleWeight;
            recordSink.beginRecord(sampleWeight);
            for (int i = 0; i < cursors.length; i++) {
View Full Code Here

            if (dictionaryBuilder == null) {
                dictionaryBuilder = new DictionaryBuilder(block.getType());
            }

            BlockCursor cursor = block.cursor();
            while (cursor.advanceNextPosition()) {
                // update run length stats
                RandomAccessBlock randomAccessBlock = cursor.getSingleValueBlock();
                if (lastValue == null) {
                    lastValue = randomAccessBlock;
                }
View Full Code Here

        BlockCursor rowCountCursor = page.getBlock(0).cursor();
        BlockCursor fragmentCursor = page.getBlock(1).cursor();
        for (int i = 0; i < page.getPositionCount(); i++) {
            checkArgument(rowCountCursor.advanceNextPosition());
            checkArgument(fragmentCursor.advanceNextPosition());
            rowCount += rowCountCursor.getLong();
            fragmentBuilder.add(fragmentCursor.getSlice().toStringUtf8());
        }
    }
View Full Code Here

        // update hashing strategy to use probe cursor
        channelSet.setCurrentValue(probeJoinCursor);

        for (int position = 0; position < page.getPositionCount(); position++) {
            checkState(probeJoinCursor.advanceNextPosition());
            if (probeJoinCursor.isNull()) {
                blockBuilder.appendNull();
            }
            else {
                boolean contains = channelSet.containsCurrentValue();
View Full Code Here

        BlockCursor cursor = page.getBlock(sampleWeightChannel).cursor();
        BlockBuilder builder = BIGINT.createBlockBuilder(new BlockBuilderStatus());

        int rowsToCopy = 0;
        // Build the sample weight block, and count how many rows of data to copy
        while (remainingLimit > 0 && cursor.advanceNextPosition()) {
            rowsToCopy++;
            long sampleWeight = cursor.getLong();
            if (sampleWeight <= remainingLimit) {
                builder.appendLong(sampleWeight);
            }
View Full Code Here

        public void addBlock(Block sourceBlock)
        {
            BlockCursor sourceCursor = sourceBlock.cursor();
            strategy.setLookupValue(sourceCursor);

            while (sourceCursor.advanceNextPosition()) {
                // Record whether we have seen a null
                containsNull |= sourceCursor.isNull();

                if (!addressValueSet.contains(CURRENT_VALUE_ADDRESS)) {
                    if (openBlockBuilder.isFull()) {
View Full Code Here

            minValues.ensureCapacity(groupIdsBlock.getGroupCount(), Long.MAX_VALUE);

            BlockCursor values = valuesBlock.cursor();

            for (int position = 0; position < groupIdsBlock.getPositionCount(); position++) {
                checkState(values.advanceNextPosition());

                long groupId = groupIdsBlock.getGroupId(position);

                if (!values.isNull()) {
                    notNull.set(groupId, true);
View Full Code Here

                    long value = values.getLong();
                    value = Math.min(value, minValues.get(groupId));
                    minValues.set(groupId, value);
                }
            }
            checkState(!values.advanceNextPosition());
        }

        @Override
        public void evaluateFinal(int groupId, BlockBuilder output)
        {
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.