Examples of BytesColumnVector


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

    return b;
  }

  private VectorizedRowBatch getBatchStrDblLongWithStrOut() {
    VectorizedRowBatch b = new VectorizedRowBatch(4);
    BytesColumnVector strCol = new BytesColumnVector();
    LongColumnVector longCol = new LongColumnVector();
    DoubleColumnVector dblCol = new DoubleColumnVector();
    BytesColumnVector outCol = new BytesColumnVector();
    b.cols[0] = strCol;
    b.cols[1] = longCol;
    b.cols[2] = dblCol;
    b.cols[3] = outCol;

    strCol.initBuffer();
    strCol.setVal(0, blue, 0, blue.length);
    strCol.setVal(1, red, 0, red.length);
    longCol.vector[0] = 0;
    longCol.vector[1] = 1;
    dblCol.vector[0] = 0.0;
    dblCol.vector[1] = 1.0;

    // set one null value for possible later use
    longCol.isNull[1] = true;

    // but have no nulls initially
    longCol.noNulls = true;
    strCol.noNulls = true;
    dblCol.noNulls = true;
    outCol.initBuffer();
    b.size = 2;
    return b;
  }
View Full Code Here

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

      red = "red".getBytes("UTF-8");
      unknown = "UNKNOWN".getBytes("UTF-8");
    } catch (Exception e) {
      ;
    }
    BytesColumnVector out;

    // with nulls
    b = getBatchStrDblLongWithStrOut();
    b.cols[0].noNulls = false;
    b.cols[0].isNull[0] = true; // set 1st entry to null
View Full Code Here

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

            lcv.vector[row] = TimestampUtils.getTimeNanoSec(t);
          }
        };

      } else if (types[i].equalsIgnoreCase("string")) {
        batch.cols[i] = new BytesColumnVector(batchSize);
        columnAssign[i] = new ColumnVectorAssign() {
          @Override
          public void assign(
              ColumnVector columnVector,
              int row,
              Object value) {
            BytesColumnVector bcv = (BytesColumnVector) columnVector;
            String s = (String) value;
            byte[] bytes = s.getBytes();
            bcv.vector[row] = bytes;
            bcv.start[row] = 0;
            bcv.length[row] = bytes.length;
View Full Code Here

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

    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;
    vrg.cols[3] = dv;
View Full Code Here

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

    lv.vector[2] = 1;
    lv.vector[3] = 1;
    batch.cols[0] = lv;

    // set second argument to IF
    BytesColumnVector v = new BytesColumnVector();
    v.initBuffer();
    setString(v, 0, "arg2_0");
    setString(v, 1, "arg2_1");
    setString(v, 2, "arg2_2");
    setString(v, 3, "arg2_3");

    batch.cols[1] = v;

    // set third argument to IF
    v = new BytesColumnVector();
    v.initBuffer();
    setString(v, 0, "arg3_0");
    setString(v, 1, "arg3_1");
    setString(v, 2, "arg3_2");
    setString(v, 3, "arg3_3");
    batch.cols[2] = v;

    // set output column
    v = new BytesColumnVector();
    v.initBuffer();
    batch.cols[3] = v;
    batch.size = 4;
    return batch;
  }
View Full Code Here

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

  @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"));
    assertTrue(getString(r, 2).equals("arg2_2"));
    assertTrue(getString(r, 3).equals("arg2_3"));
View Full Code Here

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

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

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

  @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"));
    assertTrue(getString(r, 1).equals("arg3_1"));
    assertTrue(getString(r, 2).equals("scalar"));
    assertTrue(getString(r, 3).equals("scalar"));
    assertTrue(r.noNulls);

    // test for null input strings
    batch = getBatch1Long3BytesVectors();
    BytesColumnVector arg3 = (BytesColumnVector) batch.cols[2];
    arg3.noNulls = false;
    arg3.isNull[1] = true;
    arg3.vector[1] = null;
    expr.evaluate(batch);
    r = (BytesColumnVector) batch.cols[3];
View Full Code Here

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

    // 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);
    assertTrue(getString(r, 0).equals("scalar2"));
    assertTrue(getString(r, 1).equals("scalar2"));
    assertTrue(getString(r, 2).equals("scalar1"));
    assertTrue(getString(r, 3).equals("scalar1"));
View Full Code Here

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

    return batch;
  }

  private VectorizedRowBatch getVectorizedRandomRowBatchStringLong(int seed, int size) {
    VectorizedRowBatch batch = new VectorizedRowBatch(2, size);
    BytesColumnVector bcv = new BytesColumnVector(size);
    Random rand = new Random(seed);
    for (int i = 0; i < size; i++) {
      /* all 32 bit numbers qualify & multiply up to get nano-seconds */
      byte[] encoded = encodeTime(1000 * 1000 * 1000 * rand.nextInt());
      bcv.vector[i] = encoded;
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.