@Test
  public void testLongScalarSubtractLongColWithRepeating() throws HiveException {
    LongColumnVector in, out;
    VectorizedRowBatch batch;
    LongScalarSubtractLongColumn expr;

    // Case 1: is repeating, no nulls
    batch = getVectorizedRowBatchSingleLongVector(
        VectorizedRowBatch.DEFAULT_SIZE);
    in = (LongColumnVector) batch.cols[0];
    in.isRepeating = true;
    out = (LongColumnVector) batch.cols[1];
    out.isRepeating = false;
    expr = new LongScalarSubtractLongColumn(100, 0, 1);
    expr.evaluate(batch);

    // verify
    Assert.assertTrue(out.isRepeating);
    Assert.assertTrue(out.noNulls);
    Assert.assertEquals(out.vector[0], 100 - 0 * 37);

    // Case 2: is repeating, has nulls
    batch = getVectorizedRowBatchSingleLongVector(
        VectorizedRowBatch.DEFAULT_SIZE);
    in = (LongColumnVector) batch.cols[0];
    in.isRepeating = true;
    in.noNulls = false;
    in.isNull[0] = true;

    out = (LongColumnVector) batch.cols[1];
    out.isRepeating = false;
    out.isNull[0] = false;
    out.noNulls = true;
    expr = new LongScalarSubtractLongColumn(100, 0, 1);
    expr.evaluate(batch);

    // verify
    Assert.assertTrue(out.isRepeating);
    Assert.assertFalse(out.noNulls);
    Assert.assertEquals(true, out.isNull[0]);
    TestVectorArithmeticExpressions.verifyLongNullDataVectorEntries(
        out, batch.selected, batch.selectedInUse, batch.size);
  }
Test vectorized expression handling for the case where there is a scalar on
the left and a column vector on the right.
ql/src/test/org/apache/hadoop/hive/ql/exec/vector/expressions/TestVectorScalarColArithmetic.java