@Test
public void testFilterStringBetween() {
int seed = 17;
VectorizedRowBatch vrb = VectorizedRowGroupGenUtil.getVectorizedRowBatch(
3, 2, seed);
vrb.cols[0] = new BytesColumnVector();
BytesColumnVector bcv = (BytesColumnVector) vrb.cols[0];
bcv.initBuffer();
bcv.setVal(0, a, 0, 1);
bcv.setVal(1, b, 0, 1);
bcv.setVal(2, c, 0, 1);
VectorExpression expr = new FilterStringColumnBetween(0, b, c);
// basic test
expr.evaluate(vrb);
assertEquals(2, vrb.size);
assertTrue(vrb.selectedInUse);
assertEquals(1, vrb.selected[0]);
assertEquals(2, vrb.selected[1]);
// nulls
vrb.selectedInUse = false;
vrb.size = 3;
bcv.noNulls = false;
bcv.isNull[2] = true;
expr.evaluate(vrb);
assertEquals(1, vrb.size);
assertEquals(1, vrb.selected[0]);
assertTrue(vrb.selectedInUse);
// repeating
vrb.selectedInUse = false;
vrb.size = 3;
bcv.noNulls = true;
bcv.isRepeating = true;
expr.evaluate(vrb);
assertEquals(0, vrb.size);
// nulls and repeating
vrb.selectedInUse = false;
vrb.size = 3;
bcv.noNulls = false;
bcv.isRepeating = true;
bcv.isNull[0] = true;
bcv.setVal(0, b, 0, 1);
expr.evaluate(vrb);
assertEquals(0, vrb.size);
}