Search in sources :

Example 1 with SetByteFunction

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

the class GetSetByteBitFunctionTest method testSetByteExpression.

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

Aggregations

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