Search in sources :

Example 1 with SetBitFunction

use of org.apache.phoenix.expression.function.SetBitFunction in project phoenix by apache.

the class GetSetByteBitFunctionTest method testSetBitExpression.

private void testSetBitExpression(Expression data, Expression offset, Expression newValue, byte[] expected) throws SQLException {
    List<Expression> expressions = Lists.newArrayList(data, offset, newValue);
    Expression setBitFunction = new SetBitFunction(expressions);
    ImmutableBytesWritable ptr = new ImmutableBytesWritable();
    setBitFunction.evaluate(null, ptr);
    byte[] result = (byte[]) setBitFunction.getDataType().toObject(ptr, setBitFunction.getSortOrder());
    assertArrayEquals(expected, result);
}
Also used : ImmutableBytesWritable(org.apache.hadoop.hbase.io.ImmutableBytesWritable) SetBitFunction(org.apache.phoenix.expression.function.SetBitFunction)

Aggregations

ImmutableBytesWritable (org.apache.hadoop.hbase.io.ImmutableBytesWritable)1 SetBitFunction (org.apache.phoenix.expression.function.SetBitFunction)1