Search in sources :

Example 1 with FilterStringGroupColGreaterEqualCharScalar

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

the class TestVectorStringExpressions method testStringColCompareCharScalarFilter.

@Test
public // Test string column to CHAR literal comparison
void testStringColCompareCharScalarFilter() {
    VectorizedRowBatch batch = makeStringBatch();
    VectorExpression expr;
    expr = new FilterStringGroupColEqualCharScalar(0, new HiveChar(new String(red2), 10));
    expr.evaluate(batch);
    // only red qualifies, and it's in entry 0
    Assert.assertTrue(batch.size == 1);
    Assert.assertTrue(batch.selected[0] == 0);
    batch = makeStringBatch();
    expr = new FilterStringGroupColLessCharScalar(0, new HiveChar(new String(red2), 8));
    expr.evaluate(batch);
    // only green qualifies, and it's in entry 1
    Assert.assertTrue(batch.size == 1);
    Assert.assertTrue(batch.selected[0] == 1);
    batch = makeStringBatch();
    expr = new FilterStringGroupColGreaterEqualCharScalar(0, new HiveChar(new String(green), 12));
    expr.evaluate(batch);
    // green and red qualify
    Assert.assertTrue(batch.size == 2);
    Assert.assertTrue(batch.selected[0] == 0);
    Assert.assertTrue(batch.selected[1] == 1);
}
Also used : VectorizedRowBatch(org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch) FilterStringGroupColEqualCharScalar(org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FilterStringGroupColEqualCharScalar) FilterStringGroupColLessCharScalar(org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FilterStringGroupColLessCharScalar) FilterStringGroupColGreaterEqualCharScalar(org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FilterStringGroupColGreaterEqualCharScalar) HiveChar(org.apache.hadoop.hive.common.type.HiveChar) Test(org.junit.Test)

Aggregations

HiveChar (org.apache.hadoop.hive.common.type.HiveChar)1 VectorizedRowBatch (org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch)1 FilterStringGroupColEqualCharScalar (org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FilterStringGroupColEqualCharScalar)1 FilterStringGroupColGreaterEqualCharScalar (org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FilterStringGroupColGreaterEqualCharScalar)1 FilterStringGroupColLessCharScalar (org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FilterStringGroupColLessCharScalar)1 Test (org.junit.Test)1