use of org.apache.hadoop.hive.ql.exec.vector.expressions.gen.DecimalColModuloDecimalColumn in project hive by apache.
the class TestVectorArithmeticExpressions method testDecimalColModuloDecimalColumn.
// Spot check decimal column modulo decimal column
@Test
public void testDecimalColModuloDecimalColumn() {
VectorizedRowBatch b = getVectorizedRowBatch3DecimalCols();
DecimalColumnVector in1 = (DecimalColumnVector) b.cols[1];
for (int i = 0; i < 3; i++) {
in1.vector[i].set(HiveDecimal.create("0.50"));
}
VectorExpression expr = new DecimalColModuloDecimalColumn(0, 1, 2);
expr.evaluate(b);
DecimalColumnVector r = (DecimalColumnVector) b.cols[2];
assertTrue(r.vector[0].getHiveDecimal().equals(HiveDecimal.create("0.20")));
assertTrue(r.vector[1].getHiveDecimal().equals(HiveDecimal.create("-0.30")));
assertTrue(r.vector[2].getHiveDecimal().equals(HiveDecimal.create("0")));
}
Aggregations