Package org.apache.hadoop.hive.ql.exec.vector

Examples of org.apache.hadoop.hive.ql.exec.vector.LongColumnVector


  @Test
  public void testIsNotNullExpr() {
    // has nulls, not repeating
    VectorizedRowBatch batch = getBatchThreeBooleanCols();
    IsNotNull expr = new IsNotNull(0, 2);
    LongColumnVector outCol = (LongColumnVector) batch.cols[2];
    expr.evaluate(batch);
    Assert.assertEquals(1, outCol.vector[0]);
    Assert.assertEquals(0, outCol.vector[4]);
    Assert.assertTrue(outCol.noNulls);
    Assert.assertFalse(outCol.isRepeating);
View Full Code Here


  @Test
  public void testLongInExpr() {

    // check basic operation
    VectorizedRowBatch b = TestVectorMathFunctions.getVectorizedRowBatchLongInLongOut();
    LongColumnVector outV = (LongColumnVector) b.cols[1];
    long[] inVals = new long[2];
    inVals[0] = 0;
    inVals[1] = -2;
    LongColumnInList expr = new LongColumnInList(0, 1);
    expr.setInListValues(inVals);
View Full Code Here

  @Test
  public void testDoubleInExpr() {

    // check basic operation
    VectorizedRowBatch b = TestVectorMathFunctions.getVectorizedRowBatchDoubleInLongOut();
    LongColumnVector outV = (LongColumnVector) b.cols[1];
    double[] inVals = new double[2];
    inVals[0] = -1.5d;
    inVals[1] = 30d;
    b.size = 2;
    DoubleColumnInList expr = new DoubleColumnInList(0, 1);
View Full Code Here

    Assert.assertEquals(1.2346d, resultV.vector[7]);
  }

  public static VectorizedRowBatch getVectorizedRowBatchDoubleInLongOut() {
    VectorizedRowBatch batch = new VectorizedRowBatch(2);
    LongColumnVector lcv;
    DoubleColumnVector dcv;
    lcv = new LongColumnVector();
    dcv = new DoubleColumnVector();
    dcv.vector[0] = -1.5d;
    dcv.vector[1] = -0.5d;
    dcv.vector[2] = -0.1d;
    dcv.vector[3] = 0d;
View Full Code Here

    return batch;
  }

  public static VectorizedRowBatch getVectorizedRowBatchLongInDoubleOut() {
    VectorizedRowBatch batch = new VectorizedRowBatch(2);
    LongColumnVector lcv;
    DoubleColumnVector dcv;
    lcv = new LongColumnVector();
    dcv = new DoubleColumnVector();
    lcv.vector[0] = -2;
    lcv.vector[1] = -1;
    lcv.vector[2] = 0;
    lcv.vector[3] = 1;
View Full Code Here

    return batch;
  }

  public static VectorizedRowBatch getVectorizedRowBatchLongInLongOut() {
    VectorizedRowBatch batch = new VectorizedRowBatch(2);
    LongColumnVector inV, outV;
    inV = new LongColumnVector();
    outV = new LongColumnVector();
    inV.vector[0] = -2;
    inV.vector[1] = 2;

    batch.cols[0] = inV;
    batch.cols[1] = outV;
View Full Code Here

    return batch;
  }

  public static VectorizedRowBatch getBatchForStringMath() {
    VectorizedRowBatch batch = new VectorizedRowBatch(3);
    LongColumnVector inL;
    BytesColumnVector inS, outS;
    inL = new LongColumnVector();
    inS = new BytesColumnVector();
    outS = new BytesColumnVector();
    inL.vector[0] = 0;
    inL.vector[1] = 255;
    inL.vector[2] = 0;
View Full Code Here

  }

  @Test
  public void testVectorFloor() {
    VectorizedRowBatch b = getVectorizedRowBatchDoubleInLongOut();
    LongColumnVector resultV = (LongColumnVector) b.cols[1];
    b.cols[0].noNulls = true;
    VectorExpression expr = new FuncFloorDoubleToLong(0, 1);
    expr.evaluate(b);
    Assert.assertEquals(-2, resultV.vector[0]);
    Assert.assertEquals(1, resultV.vector[6]);
View Full Code Here

  }

  @Test
  public void testVectorCeil() {
    VectorizedRowBatch b = getVectorizedRowBatchDoubleInLongOut();
    LongColumnVector resultV = (LongColumnVector) b.cols[1];
    b.cols[0].noNulls = true;
    VectorExpression expr = new FuncCeilDoubleToLong(0, 1);
    expr.evaluate(b);
    Assert.assertEquals(-1, resultV.vector[0]);
    Assert.assertEquals(2, resultV.vector[6]);
View Full Code Here

    expr.evaluate(b);
    Assert.assertTrue(equalsWithinTolerance(((-4.0d % 0.3d) + 0.3d) % 0.3d, resultV.vector[4]));

    // test long->long version
    b = getVectorizedRowBatchLongInLongOut();
    LongColumnVector resV2 = (LongColumnVector) b.cols[1];
    b.cols[0].noNulls = true;
    expr = new PosModLongToLong(0, 3, 1);
    //((ISetLongArg) expr).setArg(3);
    expr.evaluate(b);
    Assert.assertEquals(((-2 % 3) + 3) % 3, resV2.vector[0]);
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hive.ql.exec.vector.LongColumnVector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.