Java Code Examples for io.prestosql.spi.block.Block#getByte()

The following examples show how to use io.prestosql.spi.block.Block#getByte() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TinyintType.java    From presto with Apache License 2.0 5 votes vote down vote up
@Override
public Object getObjectValue(ConnectorSession session, Block block, int position)
{
    if (block.isNull(position)) {
        return null;
    }

    return block.getByte(position, 0);
}
 
Example 2
Source File: TinyintType.java    From presto with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equalTo(Block leftBlock, int leftPosition, Block rightBlock, int rightPosition)
{
    int leftValue = leftBlock.getByte(leftPosition, 0);
    int rightValue = rightBlock.getByte(rightPosition, 0);
    return leftValue == rightValue;
}
 
Example 3
Source File: TinyintType.java    From presto with Apache License 2.0 5 votes vote down vote up
@Override
public int compareTo(Block leftBlock, int leftPosition, Block rightBlock, int rightPosition)
{
    // WARNING: the correctness of InCodeGenerator is dependent on the implementation of this
    // function being the equivalence of internal long representation.
    byte leftValue = leftBlock.getByte(leftPosition, 0);
    byte rightValue = rightBlock.getByte(rightPosition, 0);
    return Byte.compare(leftValue, rightValue);
}
 
Example 4
Source File: BooleanType.java    From presto with Apache License 2.0 5 votes vote down vote up
@Override
public Object getObjectValue(ConnectorSession session, Block block, int position)
{
    if (block.isNull(position)) {
        return null;
    }

    return block.getByte(position, 0) != 0;
}
 
Example 5
Source File: BooleanType.java    From presto with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equalTo(Block leftBlock, int leftPosition, Block rightBlock, int rightPosition)
{
    boolean leftValue = leftBlock.getByte(leftPosition, 0) != 0;
    boolean rightValue = rightBlock.getByte(rightPosition, 0) != 0;
    return leftValue == rightValue;
}
 
Example 6
Source File: BooleanType.java    From presto with Apache License 2.0 5 votes vote down vote up
@Override
public int compareTo(Block leftBlock, int leftPosition, Block rightBlock, int rightPosition)
{
    boolean leftValue = leftBlock.getByte(leftPosition, 0) != 0;
    boolean rightValue = rightBlock.getByte(rightPosition, 0) != 0;
    return Boolean.compare(leftValue, rightValue);
}
 
Example 7
Source File: TinyintType.java    From presto with Apache License 2.0 4 votes vote down vote up
@Override
public long getLong(Block block, int position)
{
    return (long) block.getByte(position, 0);
}
 
Example 8
Source File: BooleanType.java    From presto with Apache License 2.0 4 votes vote down vote up
@Override
public long hash(Block block, int position)
{
    boolean value = block.getByte(position, 0) != 0;
    return value ? 1231 : 1237;
}
 
Example 9
Source File: BooleanType.java    From presto with Apache License 2.0 4 votes vote down vote up
@Override
public boolean getBoolean(Block block, int position)
{
    return block.getByte(position, 0) != 0;
}