Search in sources :

Example 1 with CharScalarEqualStringGroupColumn

use of org.apache.hadoop.hive.ql.exec.vector.expressions.gen.CharScalarEqualStringGroupColumn 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]);
}
Also used : VectorizedRowBatch(org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch) HiveChar(org.apache.hadoop.hive.common.type.HiveChar) LongColumnVector(org.apache.hadoop.hive.ql.exec.vector.LongColumnVector) VarCharScalarEqualStringGroupColumn(org.apache.hadoop.hive.ql.exec.vector.expressions.gen.VarCharScalarEqualStringGroupColumn) FilterCharScalarEqualStringGroupColumn(org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FilterCharScalarEqualStringGroupColumn) FilterVarCharScalarEqualStringGroupColumn(org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FilterVarCharScalarEqualStringGroupColumn) CharScalarEqualStringGroupColumn(org.apache.hadoop.hive.ql.exec.vector.expressions.gen.CharScalarEqualStringGroupColumn) Test(org.junit.Test)

Aggregations

HiveChar (org.apache.hadoop.hive.common.type.HiveChar)1 LongColumnVector (org.apache.hadoop.hive.ql.exec.vector.LongColumnVector)1 VectorizedRowBatch (org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch)1 CharScalarEqualStringGroupColumn (org.apache.hadoop.hive.ql.exec.vector.expressions.gen.CharScalarEqualStringGroupColumn)1 FilterCharScalarEqualStringGroupColumn (org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FilterCharScalarEqualStringGroupColumn)1 FilterVarCharScalarEqualStringGroupColumn (org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FilterVarCharScalarEqualStringGroupColumn)1 VarCharScalarEqualStringGroupColumn (org.apache.hadoop.hive.ql.exec.vector.expressions.gen.VarCharScalarEqualStringGroupColumn)1 Test (org.junit.Test)1