@Test
  public void testLongColDivideLongColumn() throws HiveException {
    /* Testing for equality of doubles after a math operation is
     * not always reliable so use this as a tolerance.
     */
    final double eps = 1e-7d;
    VectorizedRowBatch batch = getVectorizedRowBatch2LongInDoubleOut();
    LongColDivideLongColumn expr = new LongColDivideLongColumn(0, 1, 2);
    batch.cols[0].isNull[1] = true;
    batch.cols[0].noNulls = false;
    batch.cols[1].noNulls = false;
    DoubleColumnVector out = (DoubleColumnVector) batch.cols[2];

    // Set so we can verify they are reset by operation
    out.noNulls = true;
    out.isRepeating = true;

    expr.evaluate(batch);

    // 0/0 for entry 0 should work but generate NaN
    assertFalse(out.noNulls);
    assertTrue(out.isNull[0]);
    assertTrue(Double.isNaN(out.vector[0]));

    // verify NULL output in entry 1 is correct
    assertTrue(out.isNull[1]);
    assertTrue(Double.isNaN(out.vector[1]));

    // check entries beyond first 2
    for (int i = 2; i != batch.size; i++) {
      assertTrue(out.vector[i] > 1.0d - eps && out.vector[i] < 1.0d + eps);
    }
    assertFalse(out.noNulls);
    assertFalse(out.isRepeating);
  }
Unit tests for vectorized arithmetic expressions.
ql/src/test/org/apache/hadoop/hive/ql/exec/vector/expressions/TestVectorArithmeticExpressions.java