@Test
  public void testBorrowSelected(){
    MutableFilterContext mutableFilterContext = new VectorizedRowBatch(0);
    mutableFilterContext.setFilterContext(true, new int[] {100, 200}, 2);

    int[] borrowedSelected = mutableFilterContext.updateSelected(1);
    // make sure we borrowed the existing array
    Assert.assertEquals(2, borrowedSelected.length);
    Assert.assertEquals(100, borrowedSelected[0]);
    Assert.assertEquals(200, borrowedSelected[1]);

    borrowedSelected = mutableFilterContext.updateSelected(3);
    Assert.assertEquals(3, borrowedSelected.length);
    Assert.assertEquals(0, borrowedSelected[0]);
    Assert.assertEquals(0, borrowedSelected[1]);
    Assert.assertEquals(0, borrowedSelected[2]);
  }
Test creation and manipulation of MutableFilterContext and FilterContext.
ql/src/test/org/apache/hadoop/hive/ql/io/filter/TestFilterContext.java