use of org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FuncLog10DoubleToDouble in project hive by apache.
the class TestVectorMathFunctions method testVectorLog10.
@Test
public void testVectorLog10() {
// test double->double version
VectorizedRowBatch b = getVectorizedRowBatchDoubleInDoubleOut();
DoubleColumnVector resultV = (DoubleColumnVector) b.cols[1];
b.cols[0].noNulls = true;
VectorExpression expr = new FuncLog10DoubleToDouble(0, 1);
expr.evaluate(b);
Assert.assertTrue(equalsWithinTolerance(Math.log(0.5d) / Math.log(10), resultV.vector[4]));
// test long->double version
b = getVectorizedRowBatchLongInDoubleOut();
resultV = (DoubleColumnVector) b.cols[1];
b.cols[0].noNulls = true;
expr = new FuncLog10LongToDouble(0, 1);
expr.evaluate(b);
Assert.assertEquals(Math.log(1) / Math.log(10), resultV.vector[3]);
}
Aggregations