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

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


    assertEquals(true, -4d == r.vector[3]);
  }

  @Test
  public void testIfExprStringColumnStringColumn() {
    VectorizedRowBatch batch = getBatch1Long3BytesVectors();
    VectorExpression expr = new IfExprStringColumnStringColumn(0, 1, 2, 3);
    BytesColumnVector r = (BytesColumnVector) batch.cols[3];
    expr.evaluate(batch);
    assertTrue(getString(r, 0).equals("arg3_0"));
    assertTrue(getString(r, 1).equals("arg3_1"));
View Full Code Here


    assertFalse(r.isNull[0] || r.isNull[1]);
  }

  @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"));
View Full Code Here

    assertTrue(!r.noNulls && r.isNull[2]);
  }

  @Test
  public void testIfExprStringScalarStringColumn() {
    VectorizedRowBatch batch = getBatch1Long3BytesVectors();
    byte[] scalar = getUTF8Bytes("scalar");
    VectorExpression expr = new IfExprStringScalarStringColumn(0,scalar, 2, 3);
    BytesColumnVector r = (BytesColumnVector) batch.cols[3];
    expr.evaluate(batch);
    assertTrue(getString(r, 0).equals("arg3_0"));
View Full Code Here

  @Test
  public void testIfExprStringScalarStringScalar() {

    // standard case
    VectorizedRowBatch batch = getBatch1Long3BytesVectors();
    byte[] scalar1 = getUTF8Bytes("scalar1");
    byte[] scalar2 = getUTF8Bytes("scalar2");
    VectorExpression expr = new IfExprStringScalarStringScalar(0,scalar1, scalar2, 3);
    BytesColumnVector r = (BytesColumnVector) batch.cols[3];
    expr.evaluate(batch);
View Full Code Here

  private static final int BOOLEAN_COLUMN_TEST_SIZE = 9;

  @Test
  public void testLongColOrLongCol() {
    VectorizedRowBatch batch = getBatchThreeBooleanCols();
    ColOrCol expr = new ColOrCol(0, 1, 2);
    LongColumnVector outCol = (LongColumnVector) batch.cols[2];
    expr.evaluate(batch);
    // verify
    Assert.assertEquals(0, outCol.vector[0]);
View Full Code Here

  /**
   * Get a batch with three boolean (long) columns.
   */
  private VectorizedRowBatch getBatchThreeBooleanCols() {
    VectorizedRowBatch batch = new VectorizedRowBatch(3, VectorizedRowBatch.DEFAULT_SIZE);
    LongColumnVector v0, v1, v2;
    v0 = new LongColumnVector(VectorizedRowBatch.DEFAULT_SIZE);
    v1 = new LongColumnVector(VectorizedRowBatch.DEFAULT_SIZE);
    v2 = new LongColumnVector(VectorizedRowBatch.DEFAULT_SIZE);
    batch.cols[0] = v0;
View Full Code Here

    return batch;
  }

  @Test
  public void testBooleanNot() {
    VectorizedRowBatch batch = getBatchThreeBooleanCols();
    NotCol expr = new NotCol(0, 2);
    LongColumnVector outCol = (LongColumnVector) batch.cols[2];
    expr.evaluate(batch);

    // Case with nulls
View Full Code Here

  }

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

  }

  @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]);
View Full Code Here

    Assert.assertEquals(1, outCol.vector[0]);
  }

  @Test
  public void testBooleanFiltersOnColumns() {
    VectorizedRowBatch batch = getBatchThreeBooleanCols();

    SelectColumnIsTrue expr = new SelectColumnIsTrue(0);
    expr.evaluate(batch);
    assertEquals(3, batch.size);
    assertEquals(2, batch.selected[0]);
View Full Code Here

TOP

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

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.