Search in sources :

Example 1 with FuncLnLongToDouble

use of org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FuncLnLongToDouble in project hive by apache.

the class TestVectorMathFunctions method testVectorLn.

@Test
public void testVectorLn() {
    // test double->double version
    VectorizedRowBatch b = getVectorizedRowBatchDoubleInDoubleOut();
    DoubleColumnVector resultV = (DoubleColumnVector) b.cols[1];
    b.cols[0].noNulls = true;
    VectorExpression expr = new FuncLnDoubleToDouble(0, 1);
    expr.evaluate(b);
    Assert.assertEquals(Math.log(0.5), resultV.vector[4]);
    // test long->double version
    b = getVectorizedRowBatchLongInDoubleOut();
    resultV = (DoubleColumnVector) b.cols[1];
    b.cols[0].noNulls = true;
    expr = new FuncLnLongToDouble(0, 1);
    expr.evaluate(b);
    Assert.assertEquals(Math.log(2), resultV.vector[4]);
}
Also used : VectorizedRowBatch(org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch) DoubleColumnVector(org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector) FuncLnDoubleToDouble(org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FuncLnDoubleToDouble) FuncLnLongToDouble(org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FuncLnLongToDouble) Test(org.junit.Test)

Aggregations

DoubleColumnVector (org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector)1 VectorizedRowBatch (org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch)1 FuncLnDoubleToDouble (org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FuncLnDoubleToDouble)1 FuncLnLongToDouble (org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FuncLnLongToDouble)1 Test (org.junit.Test)1