Search in sources :

Example 1 with SignFunction

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

the class SignFunctionTest method testExpression.

private static void testExpression(LiteralExpression literal, Integer expected) throws SQLException {
    List<Expression> expressions = Lists.newArrayList((Expression) literal);
    Expression signFunction = new SignFunction(expressions);
    ImmutableBytesWritable ptr = new ImmutableBytesWritable();
    signFunction.evaluate(null, ptr);
    Integer result = (Integer) signFunction.getDataType().toObject(ptr, signFunction.getSortOrder());
    assertTrue(result.compareTo(expected) == 0);
}
Also used : PInteger(org.apache.phoenix.schema.types.PInteger) ImmutableBytesWritable(org.apache.hadoop.hbase.io.ImmutableBytesWritable) SignFunction(org.apache.phoenix.expression.function.SignFunction)

Aggregations

ImmutableBytesWritable (org.apache.hadoop.hbase.io.ImmutableBytesWritable)1 SignFunction (org.apache.phoenix.expression.function.SignFunction)1 PInteger (org.apache.phoenix.schema.types.PInteger)1