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);
}
Aggregations