use of org.apache.hadoop.hive.ql.exec.vector.LongColumnVector in project hive by apache.
the class TestVectorStringExpressions method testCharScalarCompareStringColProjection.
@Test
public void testCharScalarCompareStringColProjection() {
VectorizedRowBatch batch = makeStringBatch();
VectorExpression expr;
expr = new CharScalarEqualStringGroupColumn(new HiveChar(new String(red2), 8), 0, 2);
expr.evaluate(batch);
Assert.assertEquals(3, batch.size);
LongColumnVector outVector = (LongColumnVector) batch.cols[2];
Assert.assertEquals(1, outVector.vector[0]);
Assert.assertEquals(0, outVector.vector[1]);
Assert.assertEquals(0, outVector.vector[2]);
batch = makeStringBatch();
expr = new CharScalarEqualStringGroupColumn(new HiveChar(new String(green), 10), 0, 2);
expr.evaluate(batch);
Assert.assertEquals(3, batch.size);
outVector = (LongColumnVector) batch.cols[2];
Assert.assertEquals(0, outVector.vector[0]);
Assert.assertEquals(1, outVector.vector[1]);
Assert.assertEquals(0, outVector.vector[2]);
}
use of org.apache.hadoop.hive.ql.exec.vector.LongColumnVector in project hive by apache.
the class TestVectorStringExpressions method makeStringBatch.
VectorizedRowBatch makeStringBatch() {
// create a batch with one string ("Bytes") column
VectorizedRowBatch batch = new VectorizedRowBatch(3);
BytesColumnVector v = new BytesColumnVector();
batch.cols[0] = v;
// to hold output if needed
batch.cols[1] = new BytesColumnVector();
// to hold boolean output
batch.cols[2] = new LongColumnVector(batch.size);
/*
* Add these 3 values:
*
* red
* green
* NULL
*/
v.setRef(0, red, 0, red.length);
v.isNull[0] = false;
v.setRef(1, green, 0, green.length);
v.isNull[1] = false;
v.setRef(2, emptyString, 0, emptyString.length);
v.isNull[2] = true;
v.noNulls = false;
batch.size = 3;
return batch;
}
use of org.apache.hadoop.hive.ql.exec.vector.LongColumnVector in project hive by apache.
the class TestVectorStringExpressions method testStringScalarCompareStringColProjection.
@Test
public void testStringScalarCompareStringColProjection() {
VectorizedRowBatch batch = makeStringBatch();
VectorExpression expr;
expr = new StringScalarEqualStringGroupColumn(red2, 0, 2);
expr.evaluate(batch);
Assert.assertEquals(3, batch.size);
LongColumnVector outVector = (LongColumnVector) batch.cols[2];
Assert.assertEquals(1, outVector.vector[0]);
Assert.assertEquals(0, outVector.vector[1]);
Assert.assertEquals(0, outVector.vector[2]);
batch = makeStringBatch();
expr = new StringScalarEqualStringGroupColumn(green, 0, 2);
expr.evaluate(batch);
Assert.assertEquals(3, batch.size);
outVector = (LongColumnVector) batch.cols[2];
Assert.assertEquals(0, outVector.vector[0]);
Assert.assertEquals(1, outVector.vector[1]);
Assert.assertEquals(0, outVector.vector[2]);
}
use of org.apache.hadoop.hive.ql.exec.vector.LongColumnVector in project hive by apache.
the class TestVectorTimestampExpressions method getVectorizedRowBatchStringLong.
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;
batch.cols[0] = bcv;
batch.cols[1] = new LongColumnVector(1);
batch.size = 1;
return batch;
}
use of org.apache.hadoop.hive.ql.exec.vector.LongColumnVector in project hive by apache.
the class TestVectorTypeCasts method testVectorCastDoubleToLong.
@Test
public void testVectorCastDoubleToLong() {
VectorizedRowBatch b = TestVectorMathFunctions.getVectorizedRowBatchDoubleInLongOut();
LongColumnVector resultV = (LongColumnVector) b.cols[1];
b.cols[0].noNulls = true;
VectorExpression expr = new CastDoubleToLong(0, 1);
expr.evaluate(b);
Assert.assertEquals(1, resultV.vector[6]);
}
Aggregations