public void testFilterLongBetween() {
int seed = 17;
VectorizedRowBatch vrb = VectorizedRowGroupGenUtil.getVectorizedRowBatch(
5, 2, seed);
LongColumnVector lcv0 = (LongColumnVector) vrb.cols[0];
VectorExpression expr1 = new FilterLongColumnBetween(0, 15, 17);
//Basic case
lcv0.vector[0] = 5;
lcv0.vector[1] = 20;
lcv0.vector[2] = 17;
lcv0.vector[3] = 15;
lcv0.vector[4] = 10;
expr1.evaluate(vrb);
assertEquals(2, vrb.size);
assertTrue(vrb.selectedInUse);
assertEquals(2, vrb.selected[0]);
assertEquals(3, vrb.selected[1]);
//With nulls
VectorizedRowBatch vrb1 = VectorizedRowGroupGenUtil.getVectorizedRowBatch(
5, 2, seed);
lcv0 = (LongColumnVector) vrb1.cols[0];
lcv0.vector[0] = 5;
lcv0.vector[1] = 20;
lcv0.vector[2] = 17;
lcv0.vector[3] = 15;
lcv0.vector[4] = 10;
lcv0.noNulls = false;
lcv0.isNull[0] = true;
lcv0.isNull[2] = true;
expr1.evaluate(vrb1);
assertEquals(1, vrb1.size);
assertTrue(vrb1.selectedInUse);
assertEquals(3, vrb1.selected[0]);
//With nulls and selected
VectorizedRowBatch vrb2 = VectorizedRowGroupGenUtil.getVectorizedRowBatch(
7, 2, seed);
vrb2.selectedInUse = true;
vrb2.selected[0] = 1;
vrb2.selected[1] = 2;
vrb2.selected[2] = 4;
vrb2.size = 3;
lcv0 = (LongColumnVector) vrb2.cols[0];
lcv0.vector[0] = 5;
lcv0.vector[1] = 20;
lcv0.vector[2] = 17;
lcv0.vector[3] = 15;
lcv0.vector[4] = 10;
lcv0.vector[5] = 19;
lcv0.vector[6] = 21;
lcv0.noNulls = false;
lcv0.isNull[0] = true;
lcv0.isNull[2] = true;
lcv0.isNull[5] = true;
expr1.evaluate(vrb2);
assertEquals(0, vrb2.size);
//Repeating non null
VectorizedRowBatch vrb3 = VectorizedRowGroupGenUtil.getVectorizedRowBatch(
7, 2, seed);
lcv0 = (LongColumnVector) vrb3.cols[0];
lcv0.isRepeating = true;
lcv0.vector[0] = 17;
lcv0.vector[1] = 20;
lcv0.vector[2] = 17;
lcv0.vector[3] = 15;
lcv0.vector[4] = 10;
expr1.evaluate(vrb3);
assertEquals(7, vrb3.size);
assertFalse(vrb3.selectedInUse);
assertTrue(lcv0.isRepeating);
//Repeating null
lcv0.noNulls = false;
lcv0.vector[0] = 17;
lcv0.isNull[0] = true;
expr1.evaluate(vrb3);
assertEquals(0, vrb3.size);
}