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

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


  public void testLongColAddLongColumn() {
    int seed = 17;
    VectorizedRowBatch vrg = VectorizedRowGroupGenUtil.getVectorizedRowBatch(
        VectorizedRowBatch.DEFAULT_SIZE,
        6, seed);
    LongColumnVector lcv0 = (LongColumnVector) vrg.cols[0];
    LongColumnVector lcv1 = (LongColumnVector) vrg.cols[1];
    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]);
    }
View Full Code Here


    numCols = iterables.length;
    this.batchSize = batchSize;
    iterators = new ArrayList<Iterator<Long>>();
    batch = new VectorizedRowBatch(numCols, batchSize);
    for (int i =0; i < numCols; i++) {
      batch.cols[i] = new LongColumnVector(batchSize);
      iterators.add(iterables[i].iterator());
    }
  }
View Full Code Here

        Iterator<Long> it = iterators.get(i);
        if (!it.hasNext()) {
          eof = true;
          break;
        }
        LongColumnVector col = (LongColumnVector)batch.cols[i];
        Long value = it.next();
        if (null == value) {
          col.noNulls = false;
          col.isNull[batch.size] = true;
        } else {
View Full Code Here

  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);
      }
      vrg.cols[j] = lcv;
    }
View Full Code Here

    return vrg;
  }

  public static LongColumnVector generateLongColumnVector(
      boolean nulls, boolean repeating, int size, Random rand) {
    LongColumnVector lcv = new LongColumnVector(size);

    lcv.noNulls = !nulls;
    lcv.isRepeating = repeating;

    long repeatingValue;
View Full Code Here

      if (types[i].equalsIgnoreCase("tinyint") ||
          types[i].equalsIgnoreCase("smallint")||
          types[i].equalsIgnoreCase("int")||
          types[i].equalsIgnoreCase("bigint")||
          types[i].equalsIgnoreCase("long")) {
        batch.cols[i] = new LongColumnVector(batchSize);
        columnAssign[i] = new ColumnVectorAssign() {
          @Override
          public void assign(
              ColumnVector columnVector,
              int row,
              Object value) {
            LongColumnVector lcv = (LongColumnVector) columnVector;
            lcv.vector[row] = Long.valueOf(value.toString());
          }
        };
      } else if (types[i].equalsIgnoreCase("boolean")) {
        batch.cols[i] = new LongColumnVector(batchSize);
        columnAssign[i] = new ColumnVectorAssign() {
          @Override
          public void assign(
              ColumnVector columnVector,
              int row,
              Object value) {
            LongColumnVector lcv = (LongColumnVector) columnVector;
            lcv.vector[row] = (Boolean) value ? 1 : 0;
          }
        };
      } else if (types[i].equalsIgnoreCase("timestamp")) {
        batch.cols[i] = new LongColumnVector(batchSize);
        columnAssign[i] = new ColumnVectorAssign() {
          @Override
          public void assign(
              ColumnVector columnVector,
              int row,
              Object value) {
            LongColumnVector lcv = (LongColumnVector) columnVector;
            Timestamp t = (Timestamp) value;
            lcv.vector[row] = TimestampUtils.getTimeNanoSec(t);
          }
        };
View Full Code Here

    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

    vrg.selectedInUse = false;
    if (count > 0) {
      vrg.size = batchSize < count ? batchSize : count;
      count -= vrg.size;
      for (int i=0; i<numCols; ++i) {
        LongColumnVector col = (LongColumnVector)vrg.cols[i];
        col.isRepeating = true;
        Long value = values[i];
        if (value == null) {
          col.isNull[0] = true;
          col.noNulls = false;
View Full Code Here

    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);
    vrg.cols[1] = dcv;
    vrg.cols[2] = bcv;
View Full Code Here

*/
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;
    v.vector[2] = 1;
    v.vector[3] = 1;
    batch.cols[0] = v;

    // set second argument to IF
    v = new LongColumnVector();
    v.vector[0] = -1;
    v.vector[1] = -2;
    v.vector[2] = -3;
    v.vector[3] = -4;
    batch.cols[1] = v;

    // set third argument to IF
    v = new LongColumnVector();
    v.vector[0] = 1;
    v.vector[1] = 2;
    v.vector[2] = 3;
    v.vector[3] = 4;
    batch.cols[2] = v;

    // set output column
    batch.cols[3] = new LongColumnVector();

    batch.size = 4;
    return batch;
  }
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.