Search in sources :

Example 1 with StringGroupColEqualVarCharScalar

use of org.apache.hadoop.hive.ql.exec.vector.expressions.gen.StringGroupColEqualVarCharScalar in project hive by apache.

the class TestVectorStringExpressions method testStringColCompareVarCharScalarProjection.

@Test
public void testStringColCompareVarCharScalarProjection() throws HiveException {
    VectorizedRowBatch batch = makeStringBatch();
    VectorExpression expr;
    expr = new StringGroupColEqualVarCharScalar(0, new HiveVarchar(new String(red2), 8).getValue().getBytes(), 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 StringGroupColEqualVarCharScalar(0, new HiveVarchar(new String(green), 10).getValue().getBytes(), 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]);
}
Also used : StringGroupColEqualVarCharScalar(org.apache.hadoop.hive.ql.exec.vector.expressions.gen.StringGroupColEqualVarCharScalar) FilterStringGroupColEqualVarCharScalar(org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FilterStringGroupColEqualVarCharScalar) VectorizedRowBatch(org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch) HiveVarchar(org.apache.hadoop.hive.common.type.HiveVarchar) LongColumnVector(org.apache.hadoop.hive.ql.exec.vector.LongColumnVector) Test(org.junit.Test)

Aggregations

HiveVarchar (org.apache.hadoop.hive.common.type.HiveVarchar)1 LongColumnVector (org.apache.hadoop.hive.ql.exec.vector.LongColumnVector)1 VectorizedRowBatch (org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch)1 FilterStringGroupColEqualVarCharScalar (org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FilterStringGroupColEqualVarCharScalar)1 StringGroupColEqualVarCharScalar (org.apache.hadoop.hive.ql.exec.vector.expressions.gen.StringGroupColEqualVarCharScalar)1 Test (org.junit.Test)1