Search in sources :

Example 16 with UsedByGeneratedCode

use of com.facebook.presto.annotation.UsedByGeneratedCode in project presto by prestodb.

the class ArrayConcatUtils method prependElement.

@UsedByGeneratedCode
public static Block prependElement(Type elementType, Object value, Block block) {
    BlockBuilder blockBuilder = elementType.createBlockBuilder(new BlockBuilderStatus(), block.getPositionCount() + 1);
    elementType.writeObject(blockBuilder, value);
    for (int i = 0; i < block.getPositionCount(); i++) {
        elementType.appendTo(block, i, blockBuilder);
    }
    return blockBuilder.build();
}
Also used : BlockBuilder(com.facebook.presto.spi.block.BlockBuilder) BlockBuilderStatus(com.facebook.presto.spi.block.BlockBuilderStatus) UsedByGeneratedCode(com.facebook.presto.annotation.UsedByGeneratedCode)

Example 17 with UsedByGeneratedCode

use of com.facebook.presto.annotation.UsedByGeneratedCode in project presto by prestodb.

the class ArrayConcatUtils method appendElement.

@UsedByGeneratedCode
public static Block appendElement(Type elementType, Block block, Object value) {
    BlockBuilder blockBuilder = elementType.createBlockBuilder(new BlockBuilderStatus(), block.getPositionCount() + 1);
    for (int i = 0; i < block.getPositionCount(); i++) {
        elementType.appendTo(block, i, blockBuilder);
    }
    elementType.writeObject(blockBuilder, value);
    return blockBuilder.build();
}
Also used : BlockBuilder(com.facebook.presto.spi.block.BlockBuilder) BlockBuilderStatus(com.facebook.presto.spi.block.BlockBuilderStatus) UsedByGeneratedCode(com.facebook.presto.annotation.UsedByGeneratedCode)

Example 18 with UsedByGeneratedCode

use of com.facebook.presto.annotation.UsedByGeneratedCode in project presto by prestodb.

the class ArrayConcatUtils method appendElement.

@UsedByGeneratedCode
public static Block appendElement(Type elementType, Block block, double value) {
    BlockBuilder blockBuilder = elementType.createBlockBuilder(new BlockBuilderStatus(), block.getPositionCount() + 1);
    for (int i = 0; i < block.getPositionCount(); i++) {
        elementType.appendTo(block, i, blockBuilder);
    }
    elementType.writeDouble(blockBuilder, value);
    return blockBuilder.build();
}
Also used : BlockBuilder(com.facebook.presto.spi.block.BlockBuilder) BlockBuilderStatus(com.facebook.presto.spi.block.BlockBuilderStatus) UsedByGeneratedCode(com.facebook.presto.annotation.UsedByGeneratedCode)

Example 19 with UsedByGeneratedCode

use of com.facebook.presto.annotation.UsedByGeneratedCode in project presto by prestodb.

the class ArrayConcatUtils method prependElement.

@UsedByGeneratedCode
public static Block prependElement(Type elementType, boolean value, Block block) {
    BlockBuilder blockBuilder = elementType.createBlockBuilder(new BlockBuilderStatus(), block.getPositionCount() + 1);
    elementType.writeBoolean(blockBuilder, value);
    for (int i = 0; i < block.getPositionCount(); i++) {
        elementType.appendTo(block, i, blockBuilder);
    }
    return blockBuilder.build();
}
Also used : BlockBuilder(com.facebook.presto.spi.block.BlockBuilder) BlockBuilderStatus(com.facebook.presto.spi.block.BlockBuilderStatus) UsedByGeneratedCode(com.facebook.presto.annotation.UsedByGeneratedCode)

Example 20 with UsedByGeneratedCode

use of com.facebook.presto.annotation.UsedByGeneratedCode in project presto by prestodb.

the class ArrayConcatUtils method prependElement.

// Usage of prependElement: ElementToArrayConcatFunction
@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();
}
Also used : BlockBuilder(com.facebook.presto.spi.block.BlockBuilder) BlockBuilderStatus(com.facebook.presto.spi.block.BlockBuilderStatus) UsedByGeneratedCode(com.facebook.presto.annotation.UsedByGeneratedCode)

Aggregations

UsedByGeneratedCode (com.facebook.presto.annotation.UsedByGeneratedCode)23 BlockBuilder (com.facebook.presto.spi.block.BlockBuilder)17 BlockBuilderStatus (com.facebook.presto.spi.block.BlockBuilderStatus)15 PrestoException (com.facebook.presto.spi.PrestoException)7 Block (com.facebook.presto.spi.block.Block)3 Slice (io.airlift.slice.Slice)3 PageBuilder (com.facebook.presto.spi.PageBuilder)2 InterleavedBlockBuilder (com.facebook.presto.spi.block.InterleavedBlockBuilder)2 OperatorType (com.facebook.presto.spi.function.OperatorType)2 Type (com.facebook.presto.spi.type.Type)2 TypeJsonUtils.appendToBlockBuilder (com.facebook.presto.type.TypeJsonUtils.appendToBlockBuilder)2 BigDecimal (java.math.BigDecimal)2 TypedSet (com.facebook.presto.operator.aggregation.TypedSet)1 InterleavedBlock (com.facebook.presto.spi.block.InterleavedBlock)1 ArrayType (com.facebook.presto.type.ArrayType)1 MapType (com.facebook.presto.type.MapType)1 RowType (com.facebook.presto.type.RowType)1 TypeJsonUtils.stackRepresentationToObject (com.facebook.presto.type.TypeJsonUtils.stackRepresentationToObject)1 ImmutableList (com.google.common.collect.ImmutableList)1 DynamicSliceOutput (io.airlift.slice.DynamicSliceOutput)1