当前位置: 首页>>代码示例>>Java>>正文


Java Type.appendTo方法代码示例

本文整理汇总了Java中com.facebook.presto.spi.type.Type.appendTo方法的典型用法代码示例。如果您正苦于以下问题:Java Type.appendTo方法的具体用法?Java Type.appendTo怎么用?Java Type.appendTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.facebook.presto.spi.type.Type的用法示例。


在下文中一共展示了Type.appendTo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildPage

import com.facebook.presto.spi.type.Type; //导入方法依赖的package包/类
public int buildPage(int position, int[] outputChannels, PageBuilder pageBuilder)
{
    while (!pageBuilder.isFull() && position < positionCount) {
        long pageAddress = valueAddresses.getLong(position);
        int blockIndex = decodeSliceIndex(pageAddress);
        int blockPosition = decodePosition(pageAddress);

        // append the row
        pageBuilder.declarePosition();
        for (int i = 0; i < outputChannels.length; i++) {
            int outputChannel = outputChannels[i];
            Type type = types.get(outputChannel);
            Block block = this.channels[outputChannel].get(blockIndex);
            type.appendTo(block, blockPosition, pageBuilder.getBlockBuilder(i));
        }

        position++;
    }

    return position;
}
 
开发者ID:y-lan,项目名称:presto,代码行数:22,代码来源:PagesIndex.java

示例2: getSelectedRows

import com.facebook.presto.spi.type.Type; //导入方法依赖的package包/类
private Page getSelectedRows()
{
    PageBuilder pageBuilder = new PageBuilder(types);
    int rowNumberChannel = types.size() - 1;

    for (int currentPosition = 0; currentPosition < inputPage.getPositionCount(); currentPosition++) {
        long partitionId = getPartitionId(currentPosition);
        long rowCount = partitionRowCount.get(partitionId);
        if (rowCount == maxRowsPerPartition.get()) {
            continue;
        }
        pageBuilder.declarePosition();
        for (int i = 0; i < outputChannels.length; i++) {
            int channel = outputChannels[i];
            Type type = types.get(channel);
            type.appendTo(inputPage.getBlock(channel), currentPosition, pageBuilder.getBlockBuilder(i));
        }
        BIGINT.writeLong(pageBuilder.getBlockBuilder(rowNumberChannel), rowCount + 1);
        partitionRowCount.set(partitionId, rowCount + 1);
    }
    if (pageBuilder.isEmpty()) {
        return null;
    }
    return pageBuilder.build();
}
 
开发者ID:y-lan,项目名称:presto,代码行数:26,代码来源:RowNumberOperator.java

示例3: output

import com.facebook.presto.spi.type.Type; //导入方法依赖的package包/类
public static void output(ArrayType outputType, MinMaxByNState state, BlockBuilder out)
{
    TypedKeyValueHeap heap = state.getTypedKeyValueHeap();
    if (heap == null || heap.isEmpty()) {
        out.appendNull();
        return;
    }

    Type elementType = outputType.getElementType();

    BlockBuilder arrayBlockBuilder = out.beginBlockEntry();
    BlockBuilder reversedBlockBuilder = elementType.createBlockBuilder(new BlockBuilderStatus(), heap.getCapacity());
    long startSize = heap.getEstimatedSize();
    heap.popAll(reversedBlockBuilder);
    state.addMemoryUsage(heap.getEstimatedSize() - startSize);

    for (int i = reversedBlockBuilder.getPositionCount() - 1; i >= 0; i--) {
        elementType.appendTo(reversedBlockBuilder, i, arrayBlockBuilder);
    }
    out.closeEntry();
}
 
开发者ID:y-lan,项目名称:presto,代码行数:22,代码来源:AbstractMinMaxByNAggregationFunction.java

示例4: createOutputPages

import com.facebook.presto.spi.type.Type; //导入方法依赖的package包/类
private static List<Page> createOutputPages(List<Type> types, List<Page> inputPages, long[] sortedAddresses)
{
    PageBuilder pageBuilder = new PageBuilder(types);
    pageBuilder.reset();
    for (long address : sortedAddresses) {
        int index = sorter.decodePageIndex(address);
        int position = sorter.decodePositionIndex(address);

        Page page = inputPages.get(index);
        for (int i = 0; i < types.size(); i++) {
            Type type = types.get(i);
            type.appendTo(page.getBlock(i), position, pageBuilder.getBlockBuilder(i));
        }
        pageBuilder.declarePosition();
    }
    return ImmutableList.of(pageBuilder.build());
}
 
开发者ID:y-lan,项目名称:presto,代码行数:18,代码来源:TestPagesIndexPageSorter.java

示例5: process

import com.facebook.presto.spi.type.Type; //导入方法依赖的package包/类
@Override
public int process(ConnectorSession session, Page page, int start, int end, PageBuilder pageBuilder)
{
    // TODO: generate bytecode for this in the future
    for (int position = start; position < end; position++) {
        if (matches(position, page)) {
            pageBuilder.declarePosition();
            for (int i = 0; i < outputTypes.size(); i++) {
                Type type = outputTypes.get(i);
                Block block = page.getBlock(i);
                BlockBuilder blockBuilder = pageBuilder.getBlockBuilder(i);
                type.appendTo(block, position, blockBuilder);
            }
        }
    }

    return end;
}
 
开发者ID:y-lan,项目名称:presto,代码行数:19,代码来源:TupleFilterProcessor.java

示例6: processColumnar

import com.facebook.presto.spi.type.Type; //导入方法依赖的package包/类
@Override
public Page processColumnar(ConnectorSession session, Page page, List<? extends Type> types)
{
    PageBuilder pageBuilder = new PageBuilder(types);
    int positionCount = page.getPositionCount();

    int[] selectedPositions = new int[positionCount];
    int selectedCount = 0;
    for (int i = 0; i < positionCount; i++) {
        if (matches(i, page)) {
            selectedPositions[selectedCount++] = i;
        }
    }

    for (int i = 0; i < outputTypes.size(); i++) {
        Type type = outputTypes.get(i);
        Block block = page.getBlock(i);
        BlockBuilder blockBuilder = pageBuilder.getBlockBuilder(i);
        for (int position : selectedPositions) {
            type.appendTo(block, position, blockBuilder);
        }
    }
    pageBuilder.declarePositions(selectedCount);
    return pageBuilder.build();
}
 
开发者ID:y-lan,项目名称:presto,代码行数:26,代码来源:TupleFilterProcessor.java

示例7: getKeys

import com.facebook.presto.spi.type.Type; //导入方法依赖的package包/类
public static Block getKeys(Type keyType, Block block)
{
    BlockBuilder blockBuilder = keyType.createBlockBuilder(new BlockBuilderStatus(), block.getPositionCount() / 2);
    for (int i = 0; i < block.getPositionCount(); i += 2) {
        keyType.appendTo(block, i, blockBuilder);
    }
    return blockBuilder.build();
}
 
开发者ID:y-lan,项目名称:presto,代码行数:9,代码来源:MapKeys.java

示例8: input

import com.facebook.presto.spi.type.Type; //导入方法依赖的package包/类
public static void input(Type type, ArrayAggregationState state, Block value, int position)
{
    BlockBuilder blockBuilder = state.getBlockBuilder();
    if (blockBuilder == null) {
        blockBuilder = type.createBlockBuilder(new BlockBuilderStatus(), 100);
        state.setBlockBuilder(blockBuilder);
    }
    long startSize = blockBuilder.getRetainedSizeInBytes();
    type.appendTo(value, position, blockBuilder);
    state.addMemoryUsage(blockBuilder.getRetainedSizeInBytes() - startSize);
}
 
开发者ID:y-lan,项目名称:presto,代码行数:12,代码来源:ArrayAggregationFunction.java

示例9: appendElement

import com.facebook.presto.spi.type.Type; //导入方法依赖的package包/类
@UsedByGeneratedCode
public static Block appendElement(Type elementType, Block block, long value)
{
    BlockBuilder blockBuilder = elementType.createBlockBuilder(new BlockBuilderStatus(), block.getPositionCount() + 1);
    for (int i = 0; i < block.getPositionCount(); i++) {
        elementType.appendTo(block, i, blockBuilder);
    }

    elementType.writeLong(blockBuilder, value);

    return blockBuilder.build();
}
 
开发者ID:y-lan,项目名称:presto,代码行数:13,代码来源:ArrayConcatUtils.java

示例10: prependElement

import com.facebook.presto.spi.type.Type; //导入方法依赖的package包/类
@UsedByGeneratedCode
public static Block prependElement(Type elementType, Slice value, Block block)
{
    BlockBuilder blockBuilder = elementType.createBlockBuilder(new BlockBuilderStatus(), block.getPositionCount() + 1);

    elementType.writeSlice(blockBuilder, value);
    for (int i = 0; i < block.getPositionCount(); i++) {
        elementType.appendTo(block, i, blockBuilder);
    }

    return blockBuilder.build();
}
 
开发者ID:y-lan,项目名称:presto,代码行数:13,代码来源:ArrayConcatUtils.java

示例11: appendTo

import com.facebook.presto.spi.type.Type; //导入方法依赖的package包/类
@Override
public void appendTo(PageBuilder pageBuilder)
{
    for (int outputIndex = 0; outputIndex < blocks.length; outputIndex++) {
        Type type = types.get(outputIndex);
        Block block = blocks[outputIndex];
        type.appendTo(block, position, pageBuilder.getBlockBuilder(outputIndex));
    }
}
 
开发者ID:y-lan,项目名称:presto,代码行数:10,代码来源:SimpleJoinProbe.java

示例12: addNewGroup

import com.facebook.presto.spi.type.Type; //导入方法依赖的package包/类
private int addNewGroup(int hashPosition, int position, Page page, int rawHash)
{
    // add the row to the open page
    Block[] blocks = page.getBlocks();
    for (int i = 0; i < channels.length; i++) {
        int hashChannel = channels[i];
        Type type = types.get(i);
        type.appendTo(blocks[hashChannel], position, currentPageBuilder.getBlockBuilder(i));
    }
    if (precomputedHashChannel.isPresent()) {
        BIGINT.writeLong(currentPageBuilder.getBlockBuilder(precomputedHashChannel.get()), rawHash);
    }
    currentPageBuilder.declarePosition();
    int pageIndex = channelBuilders.get(0).size() - 1;
    int pagePosition = currentPageBuilder.getPositionCount() - 1;
    long address = encodeSyntheticAddress(pageIndex, pagePosition);

    // record group id in hash
    int groupId = nextGroupId++;

    groupAddressByHash[hashPosition] = address;
    groupIdsByHash[hashPosition] = groupId;
    groupAddressByGroupId.set(groupId, address);

    // create new page builder if this page is full
    if (currentPageBuilder.isFull()) {
        startNewPage();
    }

    // increase capacity, if necessary
    if (nextGroupId >= maxFill) {
        rehash();
    }
    return groupId;
}
 
开发者ID:y-lan,项目名称:presto,代码行数:36,代码来源:MultiChannelGroupByHash.java

示例13: addInput

import com.facebook.presto.spi.type.Type; //导入方法依赖的package包/类
@Override
public void addInput(Page page)
{
    checkState(needsInput());
    operatorContext.setMemoryReservation(groupByHash.getEstimatedSize());

    pageBuilder.reset();

    GroupByIdBlock ids = groupByHash.getGroupIds(page);
    for (int position = 0; position < ids.getPositionCount(); position++) {
        if (ids.getGroupId(position) == nextDistinctId) {
            pageBuilder.declarePosition();
            for (int channel = 0; channel < types.size(); channel++) {
                Type type = types.get(channel);
                type.appendTo(page.getBlock(channel), position, pageBuilder.getBlockBuilder(channel));
            }
            remainingLimit--;
            nextDistinctId++;
            if (remainingLimit == 0) {
                break;
            }
        }
    }
    if (!pageBuilder.isEmpty()) {
        outputPage = pageBuilder.build();
    }
}
 
开发者ID:y-lan,项目名称:presto,代码行数:28,代码来源:DistinctLimitOperator.java

示例14: appendTo

import com.facebook.presto.spi.type.Type; //导入方法依赖的package包/类
@Override
public void appendTo(int blockIndex, int position, PageBuilder pageBuilder, int outputChannelOffset)
{
    for (int i = 0; i < channels.size(); i++) {
        Type type = types.get(i);
        List<Block> channel = channels.get(i);
        Block block = channel.get(blockIndex);
        type.appendTo(block, position, pageBuilder.getBlockBuilder(outputChannelOffset));
        outputChannelOffset++;
    }
}
 
开发者ID:y-lan,项目名称:presto,代码行数:12,代码来源:SimplePagesHashStrategy.java

示例15: getOutput

import com.facebook.presto.spi.type.Type; //导入方法依赖的package包/类
@Override
public Page getOutput()
{
    while (!pageBuilder.isFull() && currentPage != null) {
        // Advance until we find data to unnest
        while (!anyUnnesterHasData()) {
            currentPosition++;
            if (currentPosition == currentPage.getPositionCount()) {
                currentPage = null;
                currentPosition = 0;
                break;
            }
            initializeUnnesters();
        }
        while (!pageBuilder.isFull() && anyUnnesterHasData()) {
            // Copy all the channels marked for replication
            for (int replicateChannel = 0; replicateChannel < replicateTypes.size(); replicateChannel++) {
                Type type = replicateTypes.get(replicateChannel);
                int channel = replicateChannels.get(replicateChannel);
                type.appendTo(currentPage.getBlock(channel), currentPosition, pageBuilder.getBlockBuilder(replicateChannel));
            }
            int offset = replicateTypes.size();

            pageBuilder.declarePosition();
            for (Unnester unnester : unnesters) {
                if (unnester.hasNext()) {
                    unnester.appendNext(pageBuilder, offset);
                }
                else {
                    for (int unnesterChannelIndex = 0; unnesterChannelIndex < unnester.getChannelCount(); unnesterChannelIndex++) {
                        pageBuilder.getBlockBuilder(offset + unnesterChannelIndex).appendNull();
                    }
                }
                offset += unnester.getChannelCount();
            }

            if (withOrdinality) {
                ordinalityCount++;
                BIGINT.writeLong(pageBuilder.getBlockBuilder(offset), ordinalityCount);
            }
        }
    }

    if ((!finishing && !pageBuilder.isFull()) || pageBuilder.isEmpty()) {
        return null;
    }

    Page page = pageBuilder.build();
    pageBuilder.reset();
    return page;
}
 
开发者ID:y-lan,项目名称:presto,代码行数:52,代码来源:UnnestOperator.java


注:本文中的com.facebook.presto.spi.type.Type.appendTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。