Examples of IfExprStringColumnStringScalar


Examples of org.apache.hadoop.hive.ql.exec.vector.expressions.IfExprStringColumnStringScalar

  @Test
  public void testIfExprStringColumnStringScalar() {
    VectorizedRowBatch batch = getBatch1Long3BytesVectors();
    byte[] scalar = getUTF8Bytes("scalar");
    VectorExpression expr = new IfExprStringColumnStringScalar(0, 1, scalar, 3);
    BytesColumnVector r = (BytesColumnVector) batch.cols[3];
    expr.evaluate(batch);
    assertTrue(getString(r, 0).equals("scalar"));
    assertTrue(getString(r, 1).equals("scalar"));
    assertTrue(getString(r, 2).equals("arg2_2"));
    assertTrue(getString(r, 3).equals("arg2_3"));
    assertTrue(r.noNulls);

    // test for null input strings
    batch = getBatch1Long3BytesVectors();
    BytesColumnVector arg2 = (BytesColumnVector) batch.cols[1];
    arg2.noNulls = false;
    arg2.isNull[2] = true;
    arg2.vector[2] = null;
    expr.evaluate(batch);
    r = (BytesColumnVector) batch.cols[3];
    assertTrue(!r.noNulls && r.isNull[2]);
  }
View Full Code Here
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.