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

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


  /* Spot check correctness of decimal scalar subtract decimal column. The case for
   * addition checks all the cases for the template, so don't do that redundantly here.
   */
  @Test
  public void testDecimalScalarSubtractDecimalColumn() {
    VectorizedRowBatch b = getVectorizedRowBatch3DecimalCols();
    Decimal128 d = new Decimal128(1);
    VectorExpression expr = new DecimalScalarSubtractDecimalColumn(d, 0, 2);

    // test without nulls
    expr.evaluate(b);
View Full Code Here


   * addition checks all the cases for the template, so don't do that redundantly here.
   */

  @Test
  public void testDecimalScalarMultiplyDecimalColumn() {
    VectorizedRowBatch b = getVectorizedRowBatch3DecimalCols();
    Decimal128 d = new Decimal128(2);
    VectorExpression expr = new DecimalScalarMultiplyDecimalColumn(d, 0, 2);

    // test without nulls
    expr.evaluate(b);
View Full Code Here

    assertTrue(r.isNull[0]);
  }

  // Make a decimal batch with three columns, including two for inputs and one for the result.
  private VectorizedRowBatch getVectorizedRowBatch3DecimalCols() {
    VectorizedRowBatch b = new VectorizedRowBatch(3);
    DecimalColumnVector v0, v1;
    b.cols[0] = v0 = new DecimalColumnVector(18, 2);
    b.cols[1] = v1 = new DecimalColumnVector(18, 2);
    b.cols[2] = new DecimalColumnVector(18, 2);
    v0.vector[0].update("1.20", (short) 2);
View Full Code Here

  private static final long LONG_VECTOR_NULL_VALUE = 1;
  private static final double DOUBLE_VECTOR_NULL_VALUE = Double.NaN;

  public static VectorizedRowBatch getVectorizedRowBatch(int size, int numCol, int seed) {
    VectorizedRowBatch vrg = new VectorizedRowBatch(numCol, size);
    for (int j = 0; j < numCol; j++) {
      LongColumnVector lcv = new LongColumnVector(size);
      for (int i = 0; i < size; i++) {
        lcv.vector[i] = (i+1) * seed * (j+1);
      }
View Full Code Here

    this.types = types;
    this.batchSize = batchSize;
    iterators = new ArrayList<Iterator<Object>>(types.length);
    columnAssign = new ColumnVectorAssign[types.length];

    batch = new VectorizedRowBatch(types.length, batchSize);
    for(int i=0; i< types.length; ++i) {
      if (types[i].equalsIgnoreCase("tinyint") ||
          types[i].equalsIgnoreCase("smallint")||
          types[i].equalsIgnoreCase("int")||
          types[i].equalsIgnoreCase("bigint")||
View Full Code Here

    int batchSize) {
    this.values = values;
    this.count = count;
    this.batchSize = batchSize;
    this.numCols = values.length;
    vrg = new VectorizedRowBatch(numCols, batchSize);
    for (int i =0; i < numCols; i++) {
      vrg.cols[i] = new LongColumnVector(batchSize);
    }
  }
View Full Code Here

    public boolean hasNext() {
      return getCurrentBatch().size > 0;
    }

    public VectorizedRowBatch next() {
      VectorizedRowBatch ret = getCurrentBatch();
      currentBatch = null;
      return ret;
    }
View Full Code Here

    this.iterables = iterables;
  }

  @Override
  public VectorizedRowBatch produceNextBatch() {
    VectorizedRowBatch ret = null;

    do {
      if (null != iterator && iterator.hasNext()) {
        ret = iterator.next();
        break;
View Full Code Here

    ConstantVectorExpression bytesCve = new ConstantVectorExpression(2, str.getBytes());
    Decimal128 decVal = new Decimal128(25.8, (short) 1);
    ConstantVectorExpression decimalCve = new ConstantVectorExpression(3, decVal);

    int size = 20;
    VectorizedRowBatch vrg = VectorizedRowGroupGenUtil.getVectorizedRowBatch(size, 4, 0);

    LongColumnVector lcv = (LongColumnVector) vrg.cols[0];
    DoubleColumnVector dcv = new DoubleColumnVector(size);
    BytesColumnVector bcv = new BytesColumnVector(size);
    DecimalColumnVector dv = new DecimalColumnVector(5, 1);
View Full Code Here

* Test vectorized conditional expression handling.
*/
public class TestVectorConditionalExpressions {

  private VectorizedRowBatch getBatch4LongVectors() {
    VectorizedRowBatch batch = new VectorizedRowBatch(4);
    LongColumnVector v = new LongColumnVector();

    // set first argument to IF -- boolean flag
    v.vector[0] = 0;
    v.vector[1] = 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.