Package io.airlift.slice

Examples of io.airlift.slice.Slice


                // write digest
                digest.serialize(sliceOutput);
                // write percentile
                sliceOutput.appendDouble(percentile);

                Slice slice = sliceOutput.slice();
                out.append(slice);
            }

            return out.build();
        }
View Full Code Here


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

                long groupId = groupIdsBlock.getGroupId(position);

                Slice value = intermediateValues.getSlice();
                long count = value.getLong(0);
                counts.add(groupId, count);

                double sum = value.getDouble(SIZE_OF_LONG);
                sums.add(groupId, sum);
            }
            checkState(!intermediateValues.advanceNextPosition());
        }
View Full Code Here

        {
            long count = counts.get((long) groupId);
            double sum = sums.get((long) groupId);

            // todo replace this when general fixed with values are supported
            Slice value = Slices.allocate(SIZE_OF_LONG + SIZE_OF_DOUBLE);
            value.setLong(0, count);
            value.setDouble(SIZE_OF_LONG, sum);
            output.append(value);
        }
View Full Code Here

        {
            BlockCursor intermediates = block.cursor();

            for (int position = 0; position < block.getPositionCount(); position++) {
                checkState(intermediates.advanceNextPosition());
                Slice value = intermediates.getSlice();
                count += value.getLong(0);
                sum += value.getDouble(SIZE_OF_LONG);
            }
        }
View Full Code Here

        @Override
        public void evaluateIntermediate(BlockBuilder out)
        {
            // todo replace this when general fixed with values are supported
            Slice value = Slices.allocate(SIZE_OF_LONG + SIZE_OF_DOUBLE);
            value.setLong(0, count);
            value.setDouble(SIZE_OF_LONG, sum);
            out.append(value);
        }
View Full Code Here

    public void appendTo(int position, BlockBuilder output)
    {
        // get slice an offset for the position
        long sliceAddress = valueAddresses.getLong(position);
        Slice slice = getSliceForSyntheticAddress(sliceAddress);
        int offset = decodePosition(sliceAddress);

        // append the tuple
        output.appendTuple(slice, offset);
    }
View Full Code Here

    }

    public boolean equals(int leftPosition, int rightPosition)
    {
        long leftSliceAddress = valueAddresses.getLong(leftPosition);
        Slice leftSlice = getSliceForSyntheticAddress(leftSliceAddress);
        int leftOffset = decodePosition(leftSliceAddress);

        long rightSliceAddress = valueAddresses.getLong(rightPosition);
        Slice rightSlice = getSliceForSyntheticAddress(rightSliceAddress);
        int rightOffset = decodePosition(rightSliceAddress);

        return valueEquals(type, leftSlice, leftOffset, rightSlice, rightOffset);
    }
View Full Code Here

    public boolean equals(int position, BlockCursor cursor)
    {
        // get slice an offset for the position
        long sliceAddress = valueAddresses.getLong(position);
        Slice slice = getSliceForSyntheticAddress(sliceAddress);
        int offset = decodePosition(sliceAddress);

        Slice rightSlice = cursor.getRawSlice();
        int rightOffset = cursor.getRawOffset();
        return valueEquals(type, slice, offset, rightSlice, rightOffset);
    }
View Full Code Here

    public int hashCode(int position)
    {
        // get slice an offset for the position
        long sliceAddress = valueAddresses.getLong(position);
        Slice slice = getSliceForSyntheticAddress(sliceAddress);
        int offset = decodePosition(sliceAddress);

        return valueHashCode(type, slice, offset);
    }
View Full Code Here

    }

    public int compare(SortOrder sortOrder, int leftPosition, int rightPosition)
    {
        long leftSliceAddress = valueAddresses.getLong(leftPosition);
        Slice leftSlice = getSliceForSyntheticAddress(leftSliceAddress);
        int leftOffset = decodePosition(leftSliceAddress);

        long rightSliceAddress = valueAddresses.getLong(rightPosition);
        Slice rightSlice = getSliceForSyntheticAddress(rightSliceAddress);
        int rightOffset = decodePosition(rightSliceAddress);

        boolean leftIsNull = tupleInfo.isNull(leftSlice, leftOffset);
        boolean rightIsNull = tupleInfo.isNull(rightSlice, rightOffset);
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.