Search in sources :

Example 11 with Union

use of com.yahoo.sketches.hll.Union in project Gaffer by gchq.

the class HllUnionSerialiserTest method testSerialiser.

private void testSerialiser(final Union sketch) {
    final double cardinality = sketch.getEstimate();
    final byte[] sketchSerialised;
    try {
        sketchSerialised = SERIALISER.serialise(sketch);
    } catch (final SerialisationException exception) {
        fail("A SerialisationException occurred");
        return;
    }
    final Union sketchDeserialised;
    try {
        sketchDeserialised = SERIALISER.deserialise(sketchSerialised);
    } catch (final SerialisationException exception) {
        fail("A SerialisationException occurred");
        return;
    }
    assertEquals(cardinality, sketchDeserialised.getEstimate(), DELTA);
}
Also used : SerialisationException(uk.gov.gchq.gaffer.exception.SerialisationException) Union(com.yahoo.sketches.hll.Union)

Aggregations

Union (com.yahoo.sketches.hll.Union)11 DataBag (org.apache.pig.data.DataBag)6 DataByteArray (org.apache.pig.data.DataByteArray)4 HllSketch (com.yahoo.sketches.hll.HllSketch)2 Tuple (org.apache.pig.data.Tuple)2 Test (org.junit.jupiter.api.Test)2 SerialisationException (uk.gov.gchq.gaffer.exception.SerialisationException)1 BinaryOperatorTest (uk.gov.gchq.koryphe.binaryoperator.BinaryOperatorTest)1