use of com.clearspring.analytics.stream.cardinality.HyperLogLogPlus in project Gaffer by gchq.
the class HyperLogLogPlusJsonSerialisationTest method testNullHyperLogLogPlusSketchIsSerialisedAsNullString.
@Test
public void testNullHyperLogLogPlusSketchIsSerialisedAsNullString() throws JsonProcessingException {
// Given
final HyperLogLogPlus sketch = null;
// When
final String sketchAsString = mapper.writeValueAsString(sketch);
// Then - Serialisation framework will serialise nulls as 'null' string.
assertEquals("null", sketchAsString);
}
use of com.clearspring.analytics.stream.cardinality.HyperLogLogPlus in project Gaffer by gchq.
the class HyperLogLogPlusAggregatorTest method shouldBeNotEqualWhenSecondAggregatorsHasNullHllp.
@Test
public void shouldBeNotEqualWhenSecondAggregatorsHasNullHllp() throws IOException {
// Given
final HyperLogLogPlusAggregator aggregator1 = new HyperLogLogPlusAggregator();
final HyperLogLogPlusAggregator aggregator2 = new HyperLogLogPlusAggregator();
final HyperLogLogPlus hllp1 = new HyperLogLogPlus(5, 5);
hllp1.offer("A");
hllp1.offer("B");
aggregator1._aggregate(hllp1);
// Then
assertNotEquals(aggregator1, aggregator2);
}
use of com.clearspring.analytics.stream.cardinality.HyperLogLogPlus in project Gaffer by gchq.
the class HyperLogLogPlusAggregatorTest method shouldBeNotEqualWhenFirstAggregatorsHasNullHllp.
@Test
public void shouldBeNotEqualWhenFirstAggregatorsHasNullHllp() throws IOException {
// Given
final HyperLogLogPlusAggregator aggregator1 = new HyperLogLogPlusAggregator();
final HyperLogLogPlusAggregator aggregator2 = new HyperLogLogPlusAggregator();
final HyperLogLogPlus hllp2 = new HyperLogLogPlus(5, 5);
hllp2.offer("A");
hllp2.offer("C");
aggregator2._aggregate(hllp2);
// Then
assertNotEquals(aggregator1, aggregator2);
}
use of com.clearspring.analytics.stream.cardinality.HyperLogLogPlus in project Gaffer by gchq.
the class HyperLogLogPlusAggregatorTest method setupHllp.
private void setupHllp(final int p, final int sp) {
hyperLogLogPlus1 = new HyperLogLogPlus(p, sp);
hyperLogLogPlus1.offer("A");
hyperLogLogPlus1.offer("B");
hyperLogLogPlus2 = new HyperLogLogPlus(p, sp);
hyperLogLogPlus2.offer("C");
hyperLogLogPlus2.offer("D");
}
use of com.clearspring.analytics.stream.cardinality.HyperLogLogPlus in project Gaffer by gchq.
the class HyperLogLogPlusAggregatorTest method shouldBeNotEqualWhenBothAggregatorsHaveSketchesWithDifferentPAndSpValues.
@Test
public void shouldBeNotEqualWhenBothAggregatorsHaveSketchesWithDifferentPAndSpValues() throws IOException {
// Given
final HyperLogLogPlusAggregator aggregator1 = new HyperLogLogPlusAggregator();
final HyperLogLogPlusAggregator aggregator2 = new HyperLogLogPlusAggregator();
final HyperLogLogPlus hllp1 = new HyperLogLogPlus(5, 5);
hllp1.offer("A");
hllp1.offer("B");
final HyperLogLogPlus hllp2 = new HyperLogLogPlus(6, 6);
hllp2.offer("A");
hllp2.offer("B");
aggregator1._aggregate(hllp1);
aggregator2._aggregate(hllp2);
// Then
assertNotEquals(aggregator1, aggregator2);
}
Aggregations