Search in sources :

Example 1 with AbstractRowBlock

use of io.trino.spi.block.AbstractRowBlock in project trino by trinodb.

the class ListaggAggregationStateSerializer method deserialize.

@Override
public void deserialize(Block block, int index, ListaggAggregationState state) {
    checkArgument(block instanceof AbstractRowBlock);
    ColumnarRow columnarRow = toColumnarRow(block);
    Slice separator = VARCHAR.getSlice(columnarRow.getField(0), index);
    boolean overflowError = BOOLEAN.getBoolean(columnarRow.getField(1), index);
    Slice overflowFiller = VARCHAR.getSlice(columnarRow.getField(2), index);
    boolean showOverflowEntryCount = BOOLEAN.getBoolean(columnarRow.getField(3), index);
    Block stateBlock = (Block) arrayType.getObject(columnarRow.getField(4), index);
    state.reset();
    state.setSeparator(separator);
    state.setOverflowError(overflowError);
    state.setOverflowFiller(overflowFiller);
    state.setShowOverflowEntryCount(showOverflowEntryCount);
    for (int i = 0; i < stateBlock.getPositionCount(); i++) {
        state.add(stateBlock, i);
    }
}
Also used : ColumnarRow.toColumnarRow(io.trino.spi.block.ColumnarRow.toColumnarRow) ColumnarRow(io.trino.spi.block.ColumnarRow) Slice(io.airlift.slice.Slice) AbstractRowBlock(io.trino.spi.block.AbstractRowBlock) Block(io.trino.spi.block.Block) AbstractRowBlock(io.trino.spi.block.AbstractRowBlock)

Aggregations

Slice (io.airlift.slice.Slice)1 AbstractRowBlock (io.trino.spi.block.AbstractRowBlock)1 Block (io.trino.spi.block.Block)1 ColumnarRow (io.trino.spi.block.ColumnarRow)1 ColumnarRow.toColumnarRow (io.trino.spi.block.ColumnarRow.toColumnarRow)1