use of org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FilterStringGroupColLessVarCharScalar in project hive by apache.
the class TestVectorStringExpressions method testStringColCompareVarCharScalarFilter.
@Test
public // Test string column to VARCHAR literal comparison
void testStringColCompareVarCharScalarFilter() throws HiveException {
VectorizedRowBatch batch = makeStringBatch();
VectorExpression expr;
expr = new FilterStringGroupColEqualVarCharScalar(0, new HiveVarchar(new String(red2), 10).getValue().getBytes());
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 FilterStringGroupColLessVarCharScalar(0, new HiveVarchar(new String(red2), 8).getValue().getBytes());
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 FilterStringGroupColGreaterEqualVarCharScalar(0, new HiveVarchar(new String(green), 12).getValue().getBytes());
expr.evaluate(batch);
// green and red qualify
Assert.assertTrue(batch.size == 2);
Assert.assertTrue(batch.selected[0] == 0);
Assert.assertTrue(batch.selected[1] == 1);
}
Aggregations