Search in sources :

Example 21 with Block

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

the class SimplePageWithPositionEqualsAndHash method hashCode.

@Override
public long hashCode(Page page, int position) {
    long hashCode = 0;
    for (int i = 0; i < equalityChannels.size(); i++) {
        int equalityChannel = equalityChannels.getInt(i);
        Block block = page.getBlock(equalityChannel);
        hashCode = 31 * hashCode + hashOperators.get(i).hashCodeNullSafe(block, position);
    }
    return hashCode;
}
Also used : Block(io.trino.spi.block.Block)

Example 22 with Block

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

the class SimplePageWithPositionEqualsAndHash method equals.

@Override
public boolean equals(Page left, int leftPosition, Page right, int rightPosition) {
    for (int i = 0; i < equalityChannels.size(); i++) {
        int equalityChannel = equalityChannels.getInt(i);
        Block leftBlock = left.getBlock(equalityChannel);
        Block rightBlock = right.getBlock(equalityChannel);
        if (distinctFromOperators.get(i).isDistinctFrom(leftBlock, leftPosition, rightBlock, rightPosition)) {
            return false;
        }
    }
    return true;
}
Also used : Block(io.trino.spi.block.Block)

Example 23 with Block

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

the class PagesIndex method getObject.

public Object getObject(int channel, int position) {
    long pageAddress = valueAddresses.getLong(position);
    Block block = channels[channel].get(decodeSliceIndex(pageAddress));
    int blockPosition = decodePosition(pageAddress);
    return types.get(channel).getObject(block, blockPosition);
}
Also used : Block(io.trino.spi.block.Block)

Example 24 with Block

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

the class PagesIndex method isNull.

public boolean isNull(int channel, int position) {
    long pageAddress = valueAddresses.getLong(position);
    Block block = channels[channel].get(decodeSliceIndex(pageAddress));
    int blockPosition = decodePosition(pageAddress);
    return block.isNull(blockPosition);
}
Also used : Block(io.trino.spi.block.Block)

Example 25 with Block

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

the class PagesIndex method getSingleValueBlock.

public Block getSingleValueBlock(int channel, int position) {
    long pageAddress = valueAddresses.getLong(position);
    Block block = channels[channel].get(decodeSliceIndex(pageAddress));
    int blockPosition = decodePosition(pageAddress);
    return block.getSingleValueBlock(blockPosition);
}
Also used : Block(io.trino.spi.block.Block)

Aggregations

Block (io.trino.spi.block.Block)520 Test (org.testng.annotations.Test)161 Page (io.trino.spi.Page)145 RunLengthEncodedBlock (io.trino.spi.block.RunLengthEncodedBlock)107 BlockBuilder (io.trino.spi.block.BlockBuilder)105 DictionaryBlock (io.trino.spi.block.DictionaryBlock)103 Type (io.trino.spi.type.Type)89 BlockAssertions.createLongsBlock (io.trino.block.BlockAssertions.createLongsBlock)65 Slice (io.airlift.slice.Slice)61 TrinoException (io.trino.spi.TrinoException)41 BlockAssertions.createLongSequenceBlock (io.trino.block.BlockAssertions.createLongSequenceBlock)39 LazyBlock (io.trino.spi.block.LazyBlock)37 ArrayType (io.trino.spi.type.ArrayType)31 RowType (io.trino.spi.type.RowType)31 ArrayList (java.util.ArrayList)31 LongArrayBlock (io.trino.spi.block.LongArrayBlock)29 VariableWidthBlock (io.trino.spi.block.VariableWidthBlock)28 BlockAssertions.createStringsBlock (io.trino.block.BlockAssertions.createStringsBlock)26 ImmutableList (com.google.common.collect.ImmutableList)25 DecimalType (io.trino.spi.type.DecimalType)25