@Test
  // Test CHAR literal to string column comparison
  public void testCharScalarCompareStringCol() throws HiveException {
    VectorizedRowBatch batch = makeStringBatch();
    VectorExpression expr;
    expr =
        new FilterCharScalarEqualStringGroupColumn(
            new HiveChar(new String(red2), 8).getStrippedValue().getBytes(), 0);
    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 FilterCharScalarGreaterStringGroupColumn(
            new HiveChar(new String(red2), 8).getStrippedValue().getBytes(), 0);
    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 FilterCharScalarLessEqualStringGroupColumn(
            new HiveChar(new String(green), 10).getStrippedValue().getBytes(), 0);
    expr.evaluate(batch);

    // green and red qualify
    Assert.assertTrue(batch.size == 2);
    Assert.assertTrue(batch.selected[0] == 0);
    Assert.assertTrue(batch.selected[1] == 1);
  }
Test vectorized expression and filter evaluation for strings.
ql/src/test/org/apache/hadoop/hive/ql/exec/vector/expressions/TestVectorStringExpressions.java