Search in sources :

Example 1 with UniqueValues

use of co.cask.cdap.dq.functions.UniqueValues in project cdap by caskdata.

the class AggregationFunctionsTest method uniqueValuesGenerateAggregationTest.

@Test
public void uniqueValuesGenerateAggregationTest() throws Exception {
    DataQualityWritable val1 = new DataQualityWritable();
    DataQualityWritable val2 = new DataQualityWritable();
    DataQualityWritable val3 = new DataQualityWritable();
    val1.set(new Text("a"));
    val2.set(new Text("a"));
    val3.set(new Text("a"));
    UniqueValues uniqueValues = new UniqueValues();
    uniqueValues.add(val1);
    uniqueValues.add(val2);
    uniqueValues.add(val3);
    byte[] output = uniqueValues.aggregate();
    Assert.assertEquals("[a]", Bytes.toString(output));
}
Also used : Text(org.apache.hadoop.io.Text) DataQualityWritable(co.cask.cdap.dq.DataQualityWritable) UniqueValues(co.cask.cdap.dq.functions.UniqueValues) Test(org.junit.Test)

Aggregations

DataQualityWritable (co.cask.cdap.dq.DataQualityWritable)1 UniqueValues (co.cask.cdap.dq.functions.UniqueValues)1 Text (org.apache.hadoop.io.Text)1 Test (org.junit.Test)1