Examples of BytesColumnVector


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

  /*
   * Input array is used to fill the entire size of the vector row batch
   */
  private VectorizedRowBatch getVectorizedRowBatchStringLong(long[] inputs, int size) {
    VectorizedRowBatch batch = new VectorizedRowBatch(2, size);
    BytesColumnVector bcv = new BytesColumnVector(size);
    for (int i = 0; i < size; i++) {
      byte[] encoded = encodeTime(inputs[i % inputs.length]);
      bcv.vector[i] = encoded;
      bcv.start[i] = 0;
      bcv.length[i] = encoded.length;
View Full Code Here

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

    return batch;
  }

  private VectorizedRowBatch getVectorizedRowBatchStringLong(byte[] vector, int start, int length) {
    VectorizedRowBatch batch = new VectorizedRowBatch(2, 1);
    BytesColumnVector bcv = new BytesColumnVector(1);

    bcv.vector[0] = vector;
    bcv.start[0] = start;
    bcv.length[0] = length;
View Full Code Here

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

  }

  private void testWriterText(TypeInfo type) throws HiveException {
    Text t1 = new Text("alpha");
    Text t2 = new Text("beta");
    BytesColumnVector bcv = new BytesColumnVector(vectorSize);
    bcv.noNulls = false;
    bcv.initBuffer();
    bcv.setVal(0, t1.getBytes(), 0, t1.getLength());
    bcv.isNull[1] = true;
    bcv.setVal(2, t2.getBytes(), 0, t2.getLength());
    bcv.isNull[3] = true;
    bcv.setVal(4, t1.getBytes(), 0, t1.getLength());
    VectorExpressionWriter vew = getWriter(type);
    for (int i = 0; i < vectorSize; i++) {
      Writable w = (Writable) vew.writeValue(bcv, i);
      if (w != null) {
        byte [] val = new byte[bcv.length[i]];
View Full Code Here

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

  }
 
  private void testSetterText(TypeInfo type) throws HiveException {
    Text t1 = new Text("alpha");
    Text t2 = new Text("beta");
    BytesColumnVector bcv = new BytesColumnVector(vectorSize);
    bcv.noNulls = false;
    bcv.initBuffer();
    bcv.setVal(0, t1.getBytes(), 0, t1.getLength());
    bcv.isNull[1] = true;
    bcv.setVal(2, t2.getBytes(), 0, t2.getLength());
    bcv.isNull[3] = true;
    bcv.setVal(4, t1.getBytes(), 0, t1.getLength());
   
    Object[] values = new Object[this.vectorSize];
    VectorExpressionWriter vew = getWriter(type);
    for (int i = 0; i < vectorSize; i++) {
      values[i] = vew.initValue(null);
View Full Code Here

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

  }

  @Test
  public void testCastLongToString() {
    VectorizedRowBatch b = TestVectorMathFunctions.getBatchForStringMath();
    BytesColumnVector resultV = (BytesColumnVector) b.cols[2];
    b.cols[1].noNulls = true;
    VectorExpression expr = new CastLongToString(1, 2);
    expr.evaluate(b);
    byte[] num255 = toBytes("255");
    Assert.assertEquals(0,
View Full Code Here

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

  public void testCastBooleanToString() {
    byte[] t = toBytes("TRUE");
    byte[] f = toBytes("FALSE");
    VectorizedRowBatch b = TestVectorMathFunctions.getBatchForStringMath();
    LongColumnVector inV = (LongColumnVector) b.cols[1];
    BytesColumnVector resultV = (BytesColumnVector) b.cols[2];
    inV.vector[1] = 1;
    VectorExpression expr = new CastBooleanToStringViaLongToString(1, 2);
    expr.evaluate(b);
    Assert.assertEquals(0,
        StringExpr.compare(f, 0, f.length,
View Full Code Here

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

  @Test
  public void testCastDecimalToString() {
    VectorizedRowBatch b = getBatchDecimalString();
    VectorExpression expr = new CastDecimalToString(0, 1);
    expr.evaluate(b);
    BytesColumnVector r = (BytesColumnVector) b.cols[1];

    byte[] v = toBytes("1.1");
    Assert.assertEquals(0,
        StringExpr.compare(v, 0, v.length,
            r.vector[0], r.start[0], r.length[0]));
View Full Code Here

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

  private VectorizedRowBatch getBatchDecimalString() {
    VectorizedRowBatch b = new VectorizedRowBatch(2);
    DecimalColumnVector dv;
    short scale = 2;
    b.cols[0] = dv = new DecimalColumnVector(18, scale);
    b.cols[1] = new BytesColumnVector();

    b.size = 3;

    dv.vector[0].update("1.1", scale);
    dv.vector[1].update("-2.2", scale);
View Full Code Here

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

    assertTrue(r.vector[2].equals(new Decimal128("99999999999999.0", r.scale)));
  }

  private VectorizedRowBatch getBatchStringDecimal() {
    VectorizedRowBatch b = new VectorizedRowBatch(2);
    BytesColumnVector bv;
    b.cols[0] = bv = new BytesColumnVector();
    b.cols[1] = new DecimalColumnVector(18, 2);

    bv.initBuffer();

    byte[] x0 = toBytes("1.10");
    byte[] x1 = toBytes("-2.20");
    byte[] x2 = toBytes("99999999999999.0");

    bv.setVal(0, x0, 0, x0.length);
    bv.setVal(1, x1, 0, x1.length);
    bv.setVal(2, x2, 0, x2.length);

    return b;
  }
View Full Code Here

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

  }

  public static VectorizedRowBatch getBatchForStringMath() {
    VectorizedRowBatch batch = new VectorizedRowBatch(3);
    LongColumnVector inL;
    BytesColumnVector inS, outS;
    inL = new LongColumnVector();
    inS = new BytesColumnVector();
    outS = new BytesColumnVector();
    inL.vector[0] = 0;
    inL.vector[1] = 255;
    inL.vector[2] = 0;
    inS.initBuffer();
    try {
      inS.setVal(0, "00".getBytes("UTF-8"), 0, 2);
      inS.setVal(1, "3232".getBytes("UTF-8"), 0, 4);
      byte[] bad = "bad data".getBytes("UTF-8");
      inS.setVal(2, bad, 0, bad.length);
    } catch (UnsupportedEncodingException e) {
      e.printStackTrace();
      Assert.assertTrue(false);
    }
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.