Package com.facebook.presto.spi.block

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


        {
            BlockCursor intermediates = block.cursor();

            OnlineVarianceCalculator calculator = new OnlineVarianceCalculator();
            for (int position = 0; position < block.getPositionCount(); position++) {
                checkState(intermediates.advanceNextPosition(), "failed to advance intermediates cursor");
                Slice slice = intermediates.getSlice();
                sum += slice.getDouble(SUM_OFFSET);
                count += slice.getLong(COUNT_OFFSET);
                calculator.deserializeFrom(slice, VARIANCE_OFFSET);
                this.calculator.merge(calculator);
View Full Code Here


                masks = maskBlock.get().cursor();
            }

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

                // skip null values
                if (!values.isNull() && (masks == null || masks.getBoolean())) {
                    long groupId = groupIdsBlock.getGroupId(position);
View Full Code Here

            ensureCapacity(groupIdsBlock.getGroupCount());

            BlockCursor intermediates = valuesBlock.cursor();

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

                // skip null values
                if (!intermediates.isNull()) {
                    long groupId = groupIdsBlock.getGroupId(position);
View Full Code Here

                    ESTIMATOR.mergeInto(slice, sliceOffset + 1, input, 0);
                    setNotNull(slice, sliceOffset);
                }
            }
            checkState(!intermediates.advanceNextPosition());
        }

        private void ensureCapacity(long groupCount)
        {
            long neededPages = (groupCount + ENTRIES_PER_SLICE) / ENTRIES_PER_SLICE;
View Full Code Here

                masks = maskBlock.get().cursor();
            }

            for (int position = 0; position < block.getPositionCount(); position++) {
                checkState(values.advanceNextPosition());
                checkState(masks == null || masks.advanceNextPosition());
                if (!values.isNull() && (masks == null || masks.getBoolean())) {
                    notNull = true;

                    long hash = hash(values, parameterType);
                    ESTIMATOR.update(hash, slice, 0);
View Full Code Here

        protected void processIntermediate(Block block)
        {
            BlockCursor intermediates = block.cursor();

            for (int position = 0; position < block.getPositionCount(); position++) {
                checkState(intermediates.advanceNextPosition());
                if (!intermediates.isNull()) {
                    notNull = true;

                    Slice input = intermediates.getSlice();
                    ESTIMATOR.mergeInto(slice, 0, input, 0);
View Full Code Here

                masks = maskBlock.get().cursor();
            }

            for (int position = 0; position < block.getPositionCount(); position++) {
                checkState(values.advanceNextPosition());
                checkState(masks == null || masks.advanceNextPosition());
                if (!values.isNull() && (masks == null || masks.getBoolean())) {
                    if (estimator == null) {
                        estimator = HyperLogLog.newInstance(NUMBER_OF_BUCKETS);
                    }
View Full Code Here

        protected void processIntermediate(Block block)
        {
            BlockCursor intermediates = block.cursor();

            for (int position = 0; position < block.getPositionCount(); position++) {
                checkState(intermediates.advanceNextPosition());
                if (!intermediates.isNull()) {
                    HyperLogLog instance = HyperLogLog.newInstance(intermediates.getSlice());

                    if (estimator == null) {
                        estimator = instance;
View Full Code Here

        if (encoding == null) {
            encoding = new RunLengthBlockEncoding(block.getEncoding());
        }

        BlockCursor cursor = block.cursor();
        while (cursor.advanceNextPosition()) {
            if (lastValue == null) {
                lastValue = cursor.getSingleValueBlock();
            }
            else if (!lastValue.equalTo(0, cursor)) {
                writeBlock();
View Full Code Here

        if (encoding == null) {
            blockBuilder = block.getType().createBlockBuilder(new BlockBuilderStatus());
            encoding = blockBuilder.getEncoding();
        }
        BlockCursor cursor = block.cursor();
        while (cursor.advanceNextPosition()) {
            cursor.appendTo(blockBuilder);
            if (blockBuilder.isFull()) {
                writeBlock();
            }
        }
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.