Package com.facebook.presto.spi.block

Examples of com.facebook.presto.spi.block.BlockBuilder.appendLong()


        }

        BlockBuilder idBlockBuilder = BIGINT.createBlockBuilder(new BlockBuilderStatus());
        for (int position = 0; position < block.getPositionCount(); position++) {
            int key = dictionaryBuilder.putIfAbsent(position, block);
            idBlockBuilder.appendLong(key);
        }
        idWriter.append(idBlockBuilder.build());

        return this;
    }
View Full Code Here


        @Override
        public final Block evaluateFinal()
        {
            BlockBuilder out = getFinalType().createBlockBuilder(new BlockBuilderStatus());

            out.appendLong(count);

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

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

            long sampleWeight = sampleWeightBlock.getLong(position);
            if (sampleWeight <= remainingLimit) {
                builder.appendLong(sampleWeight);
            }
            else {
                builder.appendLong(remainingLimit);
            }
            remainingLimit -= sampleWeight;
        }

        if (remainingLimit >= 0 && rowsToCopy == page.getPositionCount()) {
View Full Code Here

        while (!pageBuilder.isFull() && advance()) {
            for (int i = 0; i < blocks.length; i++) {
                BlockBuilder builder = pageBuilder.getBlockBuilder(i);
                if (i == sampleWeightChannel) {
                    if (distinct) {
                        builder.appendLong(1);
                    }
                    else {
                        builder.appendLong(sampleWeight);
                    }
                }
View Full Code Here

                if (i == sampleWeightChannel) {
                    if (distinct) {
                        builder.appendLong(1);
                    }
                    else {
                        builder.appendLong(sampleWeight);
                    }
                }
                else {
                    blocks[i].appendTo(position, builder);
                }
View Full Code Here

        for (int position = 0; position < page.getPositionCount(); position++) {
            // get the group for the current row
            int groupId = putIfAbsent(position, blocks);

            // output the group id for this row
            blockBuilder.appendLong(groupId);
        }

        Block block = blockBuilder.build();
        return new GroupByIdBlock(nextGroupId, block);
    }
View Full Code Here

                        Class<?> javaType = type.getJavaType();
                        if (javaType == boolean.class) {
                            output.appendBoolean(cursor.getBoolean(column));
                        }
                        else if (javaType == long.class) {
                            output.appendLong(cursor.getLong(column));
                        }
                        else if (javaType == double.class) {
                            output.appendDouble(cursor.getDouble(column));
                        }
                        else if (javaType == Slice.class) {
View Full Code Here

            @Override
            public Page apply(Page page)
            {
                BlockBuilder builder = BIGINT.createBlockBuilder(new BlockBuilderStatus());
                for (int i = 0; i < page.getPositionCount(); i++) {
                    builder.appendLong(sampleWeight);
                }
                Block[] blocks = new Block[page.getChannelCount() + 1];
                System.arraycopy(page.getBlocks(), 0, blocks, 0, page.getChannelCount());
                blocks[blocks.length - 1] = builder.build();
                return new Page(blocks);
View Full Code Here

        Page page = new Page(builder.build());
        int pageSize = serializedSize(page);
        assertEquals(pageSize, 26); // page overhead

        // page with one value
        page = new Page(builder.appendLong(123).build());
        int firstValueSize = serializedSize(page) - pageSize;
        assertEquals(firstValueSize, 8 + 1); // value size + value overhead

        // page with two values
        page = new Page(builder.appendLong(456).build());
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.