use of com.yahoo.sketches.frequencies.LongsSketch in project Gaffer by gchq.
the class LongsSketchAggregatorTest method setup.
@Before
public void setup() {
sketch1 = new LongsSketch(32);
sketch1.update(1L);
sketch1.update(2L);
sketch1.update(3L);
sketch2 = new LongsSketch(32);
sketch2.update(4L);
sketch2.update(5L);
sketch2.update(6L);
sketch2.update(7L);
sketch2.update(3L);
}
use of com.yahoo.sketches.frequencies.LongsSketch in project Gaffer by gchq.
the class LongsSketchAggregatorTest method testAggregate.
@Test
public void testAggregate() {
final LongsSketchAggregator sketchAggregator = new LongsSketchAggregator();
sketchAggregator.init();
sketchAggregator._aggregate(sketch1);
LongsSketch currentState = sketchAggregator._state();
assertEquals(1L, currentState.getEstimate(1L));
sketchAggregator._aggregate(sketch2);
currentState = sketchAggregator._state();
assertEquals(1L, currentState.getEstimate(1L));
assertEquals(2L, currentState.getEstimate(3L));
}
use of com.yahoo.sketches.frequencies.LongsSketch in project Gaffer by gchq.
the class LongsSketchAggregatorTest method testEquals.
@Test
public void testEquals() {
final LongsSketch sketch1 = new LongsSketch(32);
sketch1.update(1L);
final LongsSketchAggregator sketchAggregator1 = new LongsSketchAggregator();
sketchAggregator1.aggregate(new LongsSketch[] { sketch1 });
final LongsSketch sketch2 = new LongsSketch(32);
sketch2.update(1L);
final LongsSketchAggregator sketchAggregator2 = new LongsSketchAggregator();
sketchAggregator2.aggregate(new LongsSketch[] { sketch2 });
assertEquals(sketchAggregator1, sketchAggregator2);
sketch2.update(2L);
sketchAggregator2.aggregate(new LongsSketch[] { sketch2 });
assertNotEquals(sketchAggregator1, sketchAggregator2);
}
Aggregations