use of org.apache.phoenix.expression.function.CbrtFunction in project phoenix by apache.
the class CbrtFunctionTest method testExpression.
private static void testExpression(LiteralExpression literal, double expected) throws SQLException {
List<Expression> expressions = Lists.newArrayList((Expression) literal);
Expression cbrtFunction = new CbrtFunction(expressions);
ImmutableBytesWritable ptr = new ImmutableBytesWritable();
cbrtFunction.evaluate(null, ptr);
Double result = (Double) cbrtFunction.getDataType().toObject(ptr, cbrtFunction.getSortOrder());
assertTrue(Math.abs(result.doubleValue() - expected) <= 1e-9);
}
Aggregations