use of co.cask.cdap.dq.functions.StandardDeviation in project cdap by caskdata.
the class AggregationFunctionsTest method standardDeviationReturnAggregationTest.
@Test
public void standardDeviationReturnAggregationTest() throws Exception {
byte[] val1 = Bytes.toBytes(10.0);
StandardDeviation standardDeviation = new StandardDeviation();
Double stdevVal = standardDeviation.deserialize(val1);
Assert.assertEquals(10.0, stdevVal, 0);
}
use of co.cask.cdap.dq.functions.StandardDeviation in project cdap by caskdata.
the class AggregationFunctionsTest method standardDeviationGenerateAggregationTest.
@Test
public void standardDeviationGenerateAggregationTest() throws Exception {
DataQualityWritable val1 = new DataQualityWritable();
val1.set(new DoubleWritable(2.0));
DataQualityWritable val2 = new DataQualityWritable();
val2.set(new DoubleWritable(5.0));
DataQualityWritable val3 = new DataQualityWritable();
val3.set(new DoubleWritable(10.0));
DataQualityWritable val4 = new DataQualityWritable();
val4.set(new DoubleWritable(52.0));
StandardDeviation standardDeviation = new StandardDeviation();
standardDeviation.add(val1);
standardDeviation.add(val2);
standardDeviation.add(val3);
standardDeviation.add(val4);
byte[] output = standardDeviation.aggregate();
Assert.assertEquals(20.265426, Bytes.toDouble(output), 0.001);
}
Aggregations