Package io.airlift.slice

Examples of io.airlift.slice.Slice


                mask >>>= 1;
            }
        }

        int blockSize = sliceInput.readInt();
        Slice slice = sliceInput.readSlice(blockSize);

        return new FixedWidthBlock(type, positionCount, slice, valueIsNull);
    }
View Full Code Here


    public FixedWidthBlockBuilder(FixedWidthType type, int positionCount)
    {
        super(type);

        Slice slice = Slices.allocate(entrySize * positionCount);

        this.blockBuilderStatus = new BlockBuilderStatus(slice.length(), slice.length());
        this.sliceOutput = slice.getOutput();

        this.valueIsNull = new boolean[positionCount];
    }
View Full Code Here

        int positionCount = getPositionCount();
        if (positionOffset < 0 || length < 0 || positionOffset + length > positionCount) {
            throw new IndexOutOfBoundsException("Invalid position " + positionOffset + " in block with " + positionCount + " positions");
        }

        Slice newSlice = sliceOutput.slice().slice(positionOffset * entrySize, length * entrySize);
        boolean[] newValueIsNull = Arrays.copyOfRange(valueIsNull, positionOffset, positionOffset + length);
        return new FixedWidthBlock(type, length, newSlice, newValueIsNull);
    }
View Full Code Here

        }

        int offset = getPositionOffset(position);
        int entrySize = getPositionLength(position);

        Slice copy = Slices.copyOf(getRawSlice(), offset, entrySize);

        return new VariableWidthBlock(type, 1, copy, new int[] {0, copy.length()}, new boolean[] {false});
    }
View Full Code Here

                mask >>>= 1;
            }
        }

        int blockSize = sliceInput.readInt();
        Slice slice = sliceInput.readSlice(blockSize);

        return new VariableWidthBlock(type, positionCount, slice, offsets, valueIsNull);
    }
View Full Code Here

    {
        if (positionOffset < 0 || length < 0 || positionOffset + length > positionCount) {
            throw new IndexOutOfBoundsException("Invalid position " + positionOffset + " in block with " + positionCount + " positions");
        }

        Slice newSlice = slice.slice(positionOffset * entrySize, length * entrySize);
        boolean[] newValueIsNull = Arrays.copyOfRange(valueIsNull, positionOffset, positionOffset + length);
        return new FixedWidthBlock(type, length, newSlice, newValueIsNull);
    }
View Full Code Here

    @Override
    public Block getSingleValueBlock(int position)
    {
        checkReadablePosition(position);

        Slice copy = Slices.copyOf(getRawSlice(), valueOffset(position), entrySize);

        return new FixedWidthBlock(type, 1, copy, new boolean[] {isNull(position)});
    }
View Full Code Here

        return slice.getDouble(SIZE_OF_LONG + SIZE_OF_DOUBLE);
    }

    public static Slice createIntermediate(long count, double mean, double m2)
    {
        Slice slice = Slices.allocate(SIZE_OF_LONG + SIZE_OF_DOUBLE + SIZE_OF_DOUBLE);
        slice.setLong(0, count);
        slice.setDouble(SIZE_OF_LONG, mean);
        slice.setDouble(SIZE_OF_LONG + SIZE_OF_DOUBLE, m2);
        return slice;
    }
View Full Code Here

                checkState(values.advanceNextPosition());

                if (!values.isNull()) {
                    long groupId = groupIdsBlock.getGroupId(position);

                    Slice slice = values.getSlice();
                    long inputCount = getCount(slice);
                    double inputMean = getMean(slice);
                    double inputM2 = getM2(slice);

                    long currentCount = counts.get(groupId);
View Full Code Here

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

                if (!values.isNull()) {
                    Slice slice = values.getSlice();
                    long inputCount = getCount(slice);
                    double inputMean = getMean(slice);
                    double inputM2 = getM2(slice);

                    // Use numerically stable variant
View Full Code Here

TOP

Related Classes of io.airlift.slice.Slice

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.