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


Java BlockBuilder.appendNull方法代码示例

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


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

示例1: output

import com.facebook.presto.spi.block.BlockBuilder; //导入方法依赖的package包/类
@OutputFunction("array<bigint>")
public static void output(DigestAndPercentileArrayState state, BlockBuilder out)
{
    QuantileDigest digest = state.getDigest();
    List<Double> percentiles = state.getPercentiles();

    if (percentiles == null || digest == null) {
        out.appendNull();
        return;
    }

    BlockBuilder blockBuilder = out.beginBlockEntry();

    for (int i = 0; i < percentiles.size(); i++) {
        Double percentile = percentiles.get(i);
        BIGINT.writeLong(blockBuilder, digest.getQuantile(percentile));
    }

    out.closeEntry();
}
 
开发者ID:y-lan,项目名称:presto,代码行数:21,代码来源:ApproximateLongPercentileArrayAggregations.java

示例2: serializePrimitive

import com.facebook.presto.spi.block.BlockBuilder; //导入方法依赖的package包/类
private static void serializePrimitive(Type type, BlockBuilder builder, Object object) {
    requireNonNull(builder, "parent builder is null");

    if (object == null) {
        builder.appendNull();
        return;
    }

    if (BOOLEAN.equals(type)) {
        BOOLEAN.writeBoolean(builder, (Boolean) object);
    } else if (BIGINT.equals(type) || INTEGER.equals(type) || SMALLINT.equals(type) || TINYINT.equals(type)
            || REAL.equals(type) || DATE.equals(type) || TIMESTAMP.equals(type)) {
        type.writeLong(builder, getLongExpressedValue(object));
    } else if (DOUBLE.equals(type)) {
        DOUBLE.writeDouble(builder, ((Number) object).doubleValue());
    } else if (isVarcharType(type) || VARBINARY.equals(type) || isCharType(type)) {
        type.writeSlice(builder, getSliceExpressedValue(object, type));
    } else {
        throw new UnsupportedOperationException("Unsupported primitive type: " + type);
    }
}
 
开发者ID:xiaoyao1991,项目名称:presto-ethereum,代码行数:22,代码来源:EthereumRecordCursor.java

示例3: output

import com.facebook.presto.spi.block.BlockBuilder; //导入方法依赖的package包/类
@OutputFunction("map<double,double>")
public static void output(State state, BlockBuilder out)
{
    if (state.get() == null) {
        out.appendNull();
    }
    else {
        Map<Double, Double> value = state.get().getBuckets();
        BlockBuilder blockBuilder = DoubleType.DOUBLE.createBlockBuilder(new BlockBuilderStatus(), value.size() * 2);
        for (Map.Entry<Double, Double> entry : value.entrySet()) {
            DoubleType.DOUBLE.writeDouble(blockBuilder, entry.getKey());
            DoubleType.DOUBLE.writeDouble(blockBuilder, entry.getValue());
        }
        Block block = blockBuilder.build();
        out.writeObject(block);
        out.closeEntry();
    }
}
 
开发者ID:y-lan,项目名称:presto,代码行数:19,代码来源:NumericHistogramAggregation.java

示例4: createAlternatingNullsBlock

import com.facebook.presto.spi.block.BlockBuilder; //导入方法依赖的package包/类
public Block[] createAlternatingNullsBlock(List<Type> types, Block... sequenceBlocks)
{
    Block[] alternatingNullsBlocks = new Block[sequenceBlocks.length];
    for (int i = 0; i < sequenceBlocks.length; i++) {
        int positionCount = sequenceBlocks[i].getPositionCount();
        Type type = types.get(i);
        BlockBuilder blockBuilder = type.createBlockBuilder(new BlockBuilderStatus(), positionCount);
        for (int position = 0; position < positionCount; position++) {
            // append null
            blockBuilder.appendNull();
            // append value
            type.appendTo(sequenceBlocks[i], position, blockBuilder);
        }
        alternatingNullsBlocks[i] = blockBuilder.build();
    }
    return alternatingNullsBlocks;
}
 
开发者ID:y-lan,项目名称:presto,代码行数:18,代码来源:AbstractTestAggregationFunction.java

示例5: getOutput

import com.facebook.presto.spi.block.BlockBuilder; //导入方法依赖的package包/类
@Override
public Page getOutput()
{
    if (finished) {
        return null;
    }
    finished = true;

    OptionalLong rowsDeletedCount = metadata.metadataDelete(session, tableHandle, tableLayout);

    PageBuilder page = new PageBuilder(TYPES);
    BlockBuilder rowsBuilder = page.getBlockBuilder(0);
    page.declarePosition();
    if (rowsDeletedCount.isPresent()) {
        BIGINT.writeLong(rowsBuilder, rowsDeletedCount.getAsLong());
    }
    else {
        rowsBuilder.appendNull();
    }
    return page.build();
}
 
开发者ID:y-lan,项目名称:presto,代码行数:22,代码来源:MetadataDeleteOperator.java

示例6: appendTo

import com.facebook.presto.spi.block.BlockBuilder; //导入方法依赖的package包/类
@Override
public void appendTo(Block block, int position, BlockBuilder blockBuilder)
{
    if (block.isNull(position)) {
        blockBuilder.appendNull();
    }
    else {
        block.writeBytesTo(position, 0, block.getLength(position), blockBuilder);
        blockBuilder.closeEntry();
    }
}
 
开发者ID:vitillo,项目名称:presto-hyperloglog,代码行数:12,代码来源:HyperLogLogType.java

示例7: serialize

import com.facebook.presto.spi.block.BlockBuilder; //导入方法依赖的package包/类
@Override
public void serialize(HyperLogLogState state, BlockBuilder out)
{
    if (state.getHyperLogLog() == null) {
        out.appendNull();
    }
    else {
        Slice slice = Slices.wrappedBuffer(HyperLogLog.toBytes(state.getHyperLogLog()));
        HyperLogLogType.HYPER_LOG_LOG.writeSlice(out, slice);
    }
}
 
开发者ID:vitillo,项目名称:presto-hyperloglog,代码行数:12,代码来源:HyperLogLogStateSerializer.java

示例8: appendTo

import com.facebook.presto.spi.block.BlockBuilder; //导入方法依赖的package包/类
@Override
public void appendTo(Block block, int position, BlockBuilder blockBuilder)
{
    if (block.isNull(position)) {
        blockBuilder.appendNull();
    }
    else {
        blockBuilder.writeLong(block.getLong(position, 0)).closeEntry();
    }
}
 
开发者ID:y-lan,项目名称:presto,代码行数:11,代码来源:IntervalDayTimeType.java

示例9: appendSliceBlockBuilder

import com.facebook.presto.spi.block.BlockBuilder; //导入方法依赖的package包/类
public static void appendSliceBlockBuilder(BlockBuilder builder, @Nullable Slice value)
{
    if (value == null) {
        builder.appendNull();
    }
    else {
        builder.writeBytes(value, 0, value.length()).closeEntry();
    }
}
 
开发者ID:y-lan,项目名称:presto,代码行数:10,代码来源:StateCompilerUtils.java

示例10: nextVector

import com.facebook.presto.spi.block.BlockBuilder; //导入方法依赖的package包/类
public void nextVector(Type type, long items, BlockBuilder builder, boolean[] isNull)
        throws IOException
{
    for (int i = 0; i < items; i++) {
        if (isNull[i]) {
            builder.appendNull();
        }
        else {
            type.writeDouble(builder, next());
        }
    }
}
 
开发者ID:y-lan,项目名称:presto,代码行数:13,代码来源:DoubleStream.java

示例11: testMultipleValuesWithNull

import com.facebook.presto.spi.block.BlockBuilder; //导入方法依赖的package包/类
@Test
public void testMultipleValuesWithNull()
{
    BlockBuilder blockBuilder = BIGINT.createBlockBuilder(new BlockBuilderStatus(), 10);
    blockBuilder.appendNull();
    BIGINT.writeLong(blockBuilder, 42);
    blockBuilder.appendNull();
    BIGINT.writeLong(blockBuilder, 42);
    Block block = blockBuilder.build();

    assertTrue(block.isNull(0));
    assertEquals(BIGINT.getLong(block, 1), 42L);
    assertTrue(block.isNull(2));
    assertEquals(BIGINT.getLong(block, 3), 42L);
}
 
开发者ID:y-lan,项目名称:presto,代码行数:16,代码来源:TestBlockBuilder.java

示例12: serialize

import com.facebook.presto.spi.block.BlockBuilder; //导入方法依赖的package包/类
@Override
public void serialize(BloomFilterState state, BlockBuilder out)
{
    if (state.getBloomFilter() == null) {
        out.appendNull();
    }
    else {
        BloomFilterType.BLOOM_FILTER.writeSlice(out, state.getBloomFilter().serialize());
    }
}
 
开发者ID:RobinUS2,项目名称:presto-bloomfilter,代码行数:11,代码来源:BloomFilterStateSerializer.java

示例13: appendTo

import com.facebook.presto.spi.block.BlockBuilder; //导入方法依赖的package包/类
@Override
public void appendTo(Block block, int position, BlockBuilder blockBuilder)
{
    if (block.isNull(position)) {
        blockBuilder.appendNull();
    }
    else {
        blockBuilder.writeObject(block.getObject(position, Block.class));
        blockBuilder.closeEntry();
    }
}
 
开发者ID:y-lan,项目名称:presto,代码行数:12,代码来源:RowType.java

示例14: serialize

import com.facebook.presto.spi.block.BlockBuilder; //导入方法依赖的package包/类
@Override
public void serialize(MinMaxByNState state, BlockBuilder out)
{
    TypedKeyValueHeap heap = state.getTypedKeyValueHeap();
    if (heap == null) {
        out.appendNull();
        return;
    }

    heap.serialize(out);
}
 
开发者ID:y-lan,项目名称:presto,代码行数:12,代码来源:MinMaxByNStateSerializer.java

示例15: regexpExtractAll

import com.facebook.presto.spi.block.BlockBuilder; //导入方法依赖的package包/类
@Description("group(s) extracted using the given pattern")
@ScalarFunction
@SqlType("array<varchar>")
public static Block regexpExtractAll(@SqlType(StandardTypes.VARCHAR) Slice source, @SqlType(RegexpType.NAME) Regex pattern, @SqlType(StandardTypes.BIGINT) long groupIndex)
{
    Matcher matcher = pattern.matcher(source.getBytes());
    validateGroup(groupIndex, matcher.getEagerRegion());
    BlockBuilder blockBuilder = VARCHAR.createBlockBuilder(new BlockBuilderStatus(), 32);
    int group = Ints.checkedCast(groupIndex);

    int nextStart = 0;
    while (true) {
        int offset = matcher.search(nextStart, source.length(), Option.DEFAULT);
        if (offset == -1) {
            break;
        }
        if (matcher.getEnd() == matcher.getBegin()) {
            nextStart = matcher.getEnd() + 1;
        }
        else {
            nextStart = matcher.getEnd();
        }
        Region region = matcher.getEagerRegion();
        int beg = region.beg[group];
        int end = region.end[group];
        if (beg == -1 || end == -1) {
            blockBuilder.appendNull();
        }
        else {
            Slice slice = source.slice(beg, end - beg);
            VARCHAR.writeSlice(blockBuilder, slice);
        }
    }
    return blockBuilder.build();
}
 
开发者ID:y-lan,项目名称:presto,代码行数:36,代码来源:RegexpFunctions.java


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