Search in sources :

Example 1 with FuncAbsLongToLong

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

the class TestVectorMathFunctions method testVectorAbs.

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

Aggregations

DoubleColumnVector (org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector)1 LongColumnVector (org.apache.hadoop.hive.ql.exec.vector.LongColumnVector)1 VectorizedRowBatch (org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch)1 FuncAbsDoubleToDouble (org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FuncAbsDoubleToDouble)1 FuncAbsLongToLong (org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FuncAbsLongToLong)1 Test (org.junit.Test)1