Examples of evaluate()


Examples of org.apache.hadoop.hive.ql.exec.vector.expressions.gen.IfExprDoubleScalarDoubleScalar.evaluate()

  @Test
  public void testDoubleScalarScalarIfExpr() {
    VectorizedRowBatch batch = getBatch1Long3DoubleVectors();
    VectorExpression expr = new IfExprDoubleScalarDoubleScalar(0, 100.0d, 200.0d, 3);
    DoubleColumnVector r = (DoubleColumnVector) batch.cols[3];
    expr.evaluate(batch);
    assertEquals(true, 200d == r.vector[0]);
    assertEquals(true, 200d == r.vector[1]);
    assertEquals(true, 100d == r.vector[2]);
    assertEquals(true, 100d == r.vector[3]);
  }

Examples of org.apache.hadoop.hive.ql.exec.vector.expressions.gen.IfExprLongColumnLongColumn.evaluate()

  @Test
  public void testLongColumnColumnIfExpr()  {
    VectorizedRowBatch batch = getBatch4LongVectors();
    VectorExpression expr = new IfExprLongColumnLongColumn(0, 1, 2, 3);
    expr.evaluate(batch);

    // get result vector
    LongColumnVector r = (LongColumnVector) batch.cols[3];

    // verify standard case

Examples of org.apache.hadoop.hive.ql.exec.vector.expressions.gen.IfExprLongColumnLongScalar.evaluate()

  @Test
  public void testLongColumnScalarIfExpr() {
    VectorizedRowBatch batch = getBatch4LongVectors();
    VectorExpression expr = new IfExprLongColumnLongScalar(0, 1, 100, 3);
    LongColumnVector r = (LongColumnVector) batch.cols[3];
    expr.evaluate(batch);
    assertEquals(100, r.vector[0]);
    assertEquals(100, r.vector[1]);
    assertEquals(-3, r.vector[2]);
    assertEquals(-4, r.vector[3]);
  }

Examples of org.apache.hadoop.hive.ql.exec.vector.expressions.gen.IfExprLongScalarLongColumn.evaluate()

  @Test
  public void testLongScalarColumnIfExpr() {
    VectorizedRowBatch batch = getBatch4LongVectors();
    VectorExpression expr = new IfExprLongScalarLongColumn(0, 100, 2, 3);
    LongColumnVector r = (LongColumnVector) batch.cols[3];
    expr.evaluate(batch);
    assertEquals(1, r.vector[0]);
    assertEquals(2, r.vector[1]);
    assertEquals(100, r.vector[2]);
    assertEquals(100, r.vector[3]);
  }

Examples of org.apache.hadoop.hive.ql.exec.vector.expressions.gen.IfExprLongScalarLongScalar.evaluate()

  @Test
  public void testLongScalarScalarIfExpr() {
    VectorizedRowBatch batch = getBatch4LongVectors();
    VectorExpression expr = new IfExprLongScalarLongScalar(0, 100, 200, 3);
    LongColumnVector r = (LongColumnVector) batch.cols[3];
    expr.evaluate(batch);
    assertEquals(200, r.vector[0]);
    assertEquals(200, r.vector[1]);
    assertEquals(100, r.vector[2]);
    assertEquals(100, r.vector[3]);
  }

Examples of org.apache.hadoop.hive.ql.exec.vector.expressions.gen.LongColAddLongColumn.evaluate()

    LongColumnVector lcv2 = (LongColumnVector) vrg.cols[2];
    LongColumnVector lcv3 = (LongColumnVector) vrg.cols[3];
    LongColumnVector lcv4 = (LongColumnVector) vrg.cols[4];
    LongColumnVector lcv5 = (LongColumnVector) vrg.cols[5];
    LongColAddLongColumn expr = new LongColAddLongColumn(0, 1, 2);
    expr.evaluate(vrg);
    for (int i = 0; i < VectorizedRowBatch.DEFAULT_SIZE; i++) {
      assertEquals((i+1) * seed * 3, lcv2.vector[i]);
    }
    assertTrue(lcv2.noNulls);

Examples of org.apache.hadoop.hive.ql.exec.vector.expressions.gen.LongColAddLongScalar.evaluate()

  @Test
  public void testLongColAddLongScalarNoNulls()  {
    VectorizedRowBatch vrg = getVectorizedRowBatchSingleLongVector(VectorizedRowBatch.DEFAULT_SIZE);
    LongColAddLongScalar expr = new LongColAddLongScalar(0, 23, 1);
    expr.evaluate(vrg);
    //verify
    for (int i = 0; i < VectorizedRowBatch.DEFAULT_SIZE; i++) {
      Assert.assertEquals(i * 37 + 23, ((LongColumnVector) vrg.cols[1]).vector[i]);
    }
    Assert.assertTrue(((LongColumnVector)vrg.cols[1]).noNulls);

Examples of org.apache.hadoop.hive.ql.exec.vector.expressions.gen.LongColUnaryMinus.evaluate()

  @Test
  public void testUnaryMinus() {
    VectorizedRowBatch vrg = VectorizedRowGroupGenUtil.getVectorizedRowBatch(1024, 2, 23);
    LongColUnaryMinus expr = new LongColUnaryMinus(0, 1);
    expr.evaluate(vrg);
    //verify
    long[] inVector = ((LongColumnVector) vrg.cols[0]).vector;
    long[] outVector = ((LongColumnVector) vrg.cols[1]).vector;
    for (int i = 0; i < outVector.length; i++) {
      assertEquals(0, inVector[i]+outVector[i]);

Examples of org.apache.hadoop.hive.ql.exec.vector.expressions.gen.LongScalarModuloLongColumn.evaluate()

  @Test
  public void testLongScalarModuloLongColNoNulls()  {
    VectorizedRowBatch batch = getBatchSingleLongVectorPositiveNonZero();
    LongScalarModuloLongColumn expr = new LongScalarModuloLongColumn(100, 0, 1);
    expr.evaluate(batch);

    // verify
    for (int i = 0; i < VectorizedRowBatch.DEFAULT_SIZE; i++) {
      Assert.assertEquals(100 % ((i + 1) * 37), ((LongColumnVector) batch.cols[1]).vector[i]);
    }

Examples of org.apache.hadoop.hive.ql.exec.vector.expressions.gen.LongScalarSubtractLongColumn.evaluate()

  @Test
  public void testLongScalarSubtractLongColNoNulls()  {
    VectorizedRowBatch batch = getVectorizedRowBatchSingleLongVector(
        VectorizedRowBatch.DEFAULT_SIZE);
    LongScalarSubtractLongColumn expr = new LongScalarSubtractLongColumn(100, 0, 1);
    expr.evaluate(batch);

    //verify
    for (int i = 0; i < VectorizedRowBatch.DEFAULT_SIZE; i++) {
      Assert.assertEquals(100 - i * 37, ((LongColumnVector) batch.cols[1]).vector[i]);
    }
TOP
Copyright © 2018 www.massapi.com. 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.