use of co.cask.cdap.dq.functions.Mean in project cdap by caskdata.
the class AggregationFunctionsTest method averageReturnAggregationTest.
@Test
public void averageReturnAggregationTest() throws Exception {
byte[] val1 = Bytes.toBytes(10.0);
Mean mean = new Mean();
Double averageVal = mean.deserialize(val1);
Assert.assertEquals(10.0, averageVal, 0);
}
use of co.cask.cdap.dq.functions.Mean in project cdap by caskdata.
the class AggregationFunctionsTest method averageGenerateAggregationTest.
@Test
public void averageGenerateAggregationTest() throws Exception {
DataQualityWritable val1 = new DataQualityWritable();
val1.set(new DoubleWritable(2.0));
DataQualityWritable val2 = new DataQualityWritable();
val2.set(new DoubleWritable(2.0));
Mean mean = new Mean();
mean.add(val1);
mean.add(val2);
byte[] output = mean.aggregate();
Assert.assertEquals(2.0, Bytes.toDouble(output), 0);
}
Aggregations