@SuppressWarnings("unchecked")
  @Test
  public void testSetDoneFromChildOperators() throws HiveException {
    VectorSelectDesc vectorSelectDesc = new VectorSelectDesc();
    vectorSelectDesc.setProjectedOutputColumns(new int[0]);
    vectorSelectDesc.setSelectExpressions(new VectorExpression[0]);
    VectorSelectOperator selOp = new VectorSelectOperator(new CompilationOpContext(),
        new SelectDesc(), new VectorizationContext("dummy"), vectorSelectDesc);
    VectorSelectOperator childOp = new VectorSelectOperator(new CompilationOpContext(),
        new SelectDesc(), new VectorizationContext("dummy"), vectorSelectDesc);

    selOp.childOperatorsArray = new Operator[1];
    selOp.childOperatorsArray[0] = childOp;
    selOp.childOperatorsTag = new int[1];
    selOp.childOperatorsTag[0] = 0;

    childOp.childOperatorsArray = new Operator[0];

    Assert.assertFalse(selOp.getDone());
    Assert.assertFalse(childOp.getDone());

    selOp.process(new VectorizedRowBatch(1), 0);
    childOp.setDone(true);

    // selOp is not done, it will detect child's done=true during the next process(batch) call
    Assert.assertFalse(selOp.getDone());
    Assert.assertTrue(childOp.getDone());

    selOp.process(new VectorizedRowBatch(1), 0);

    // selOp detects child's done=true, so it turns to done=true
    Assert.assertTrue(selOp.getDone());
    Assert.assertTrue(childOp.getDone());
  }
A custom input format that checks to make sure that the fetch operator
sets the required attributes.
ql/src/test/org/apache/hadoop/hive/ql/exec/TestOperators.java