Examples of BytesColumnVector


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

  @Test
  public void testVectorBin() {

    // test conversion of long->string
    VectorizedRowBatch b = getBatchForStringMath();
    BytesColumnVector resultV = (BytesColumnVector) b.cols[2];
    b.cols[0].noNulls = true;
    VectorExpression expr = new FuncBin(1, 2);
    expr.evaluate(b);
    String s = new String(resultV.vector[1], resultV.start[1], resultV.length[1]);
    Assert.assertEquals("11111111", s);
View Full Code Here

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

  @Test
  public void testVectorHex() {

    // test long->string version
    VectorizedRowBatch b = getBatchForStringMath();
    BytesColumnVector resultV = (BytesColumnVector) b.cols[2];
    b.cols[1].noNulls = true;
    VectorExpression expr = new FuncHex(1, 2);
    expr.evaluate(b);
    String s = new String(resultV.vector[1], resultV.start[1], resultV.length[1]);
    Assert.assertEquals("FF", s);
View Full Code Here

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

  private long toTimestamp(long date) {
    return DateWritable.daysToMillis((int) date) * 1000000;
  }

  private BytesColumnVector toString(LongColumnVector date) {
    BytesColumnVector bcv = new BytesColumnVector(size);
    for (int i = 0; i < size; i++) {
      if (date.isNull[i]) {
        bcv.isNull[i] = true;
        bcv.noNulls = false;
      } else {
View Full Code Here

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

    } else {
      udf = new VectorUDFDateSubColScalar(0, scalar2, 1);
    }
    udf.setInputTypes(colType1, VectorExpression.Type.OTHER);
    udf.evaluate(batch);
    BytesColumnVector output = (BytesColumnVector) batch.cols[1];

    try {
      for (int i = 0; i < size; i++) {
        String expected;
        if (isPositive) {
View Full Code Here

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

  private void testDateAddColScalar(VectorExpression.Type colType1, boolean isPositive) {
    LongColumnVector date1 = newRandomLongColumnVector(10000, size);
    ColumnVector col1 = castTo(date1, colType1);
    long scalar2 = newRandom(1000);
    BytesColumnVector output = new BytesColumnVector(size);

    VectorizedRowBatch batch = new VectorizedRowBatch(2, size);
    batch.cols[0] = col1;
    batch.cols[1] = output;
View Full Code Here

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

      testDateAddColScalar(colType1, true);

    VectorExpression udf = new VectorUDFDateAddColScalar(0, 0, 1);
    udf.setInputTypes(VectorExpression.Type.STRING, VectorExpression.Type.TIMESTAMP);
    VectorizedRowBatch batch = new VectorizedRowBatch(2, 1);
    batch.cols[0] = new BytesColumnVector(1);
    batch.cols[1] = new BytesColumnVector(1);
    BytesColumnVector bcv = (BytesColumnVector) batch.cols[0];
    byte[] bytes = new byte[0];
    try {
      bytes = "error".getBytes("UTF-8");
    } catch (UnsupportedEncodingException e) {
    }
View Full Code Here

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

      testDateAddColScalar(colType1, false);

    VectorExpression udf = new VectorUDFDateSubColScalar(0, 0, 1);
    udf.setInputTypes(VectorExpression.Type.STRING, VectorExpression.Type.TIMESTAMP);
    VectorizedRowBatch batch = new VectorizedRowBatch(2, 1);
    batch.cols[0] = new BytesColumnVector(1);
    batch.cols[1] = new BytesColumnVector(1);
    BytesColumnVector bcv = (BytesColumnVector) batch.cols[0];
    byte[] bytes = new byte[0];
    try {
      bytes = "error".getBytes("UTF-8");
    } catch (UnsupportedEncodingException e) {
    }
View Full Code Here

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

      }
    }
    udf.setInputTypes(colType1, VectorExpression.Type.OTHER);
    udf.evaluate(batch);

    BytesColumnVector output = (BytesColumnVector) batch.cols[1];
    try {
      for (int i = 0; i < date2.vector.length; i++) {
        String expected;
        if (isPositive) {
          expected = new String(toString(scalar1 + date2.vector[i]), "UTF-8");
View Full Code Here

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

  private void testDateAddScalarCol(VectorExpression.Type colType1, boolean isPositive) {
    LongColumnVector date2 = newRandomLongColumnVector(10000, size);
    long scalar1 = newRandom(1000);

    BytesColumnVector output = new BytesColumnVector(size);

    VectorizedRowBatch batch = new VectorizedRowBatch(2, size);
    batch.cols[0] = date2;
    batch.cols[1] = output;
    validateDateAdd(batch, scalar1, date2, colType1, isPositive);
View Full Code Here

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

    } catch (UnsupportedEncodingException e) {
    }
    udf.setInputTypes(VectorExpression.Type.STRING, VectorExpression.Type.TIMESTAMP);
    VectorizedRowBatch batch = new VectorizedRowBatch(2, 1);
    batch.cols[0] = new LongColumnVector(1);
    batch.cols[1] = new BytesColumnVector(1);
    udf.evaluate(batch);
    Assert.assertEquals(batch.cols[1].isNull[0], true);
  }
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.