use of org.apache.accumulo.core.client.summary.summarizers.VisibilitySummarizer in project accumulo by apache.
the class CountingSummarizerTest method testMerge.
@Test
public void testMerge() {
SummarizerConfiguration sc = SummarizerConfiguration.builder(VisibilitySummarizer.class).addOption(MAX_COUNTERS_OPT, "5").build();
VisibilitySummarizer countSum = new VisibilitySummarizer();
String p = COUNTER_STAT_PREFIX;
HashMap<String, Long> sm1 = new HashMap<>();
sm1.put(p + "f001", 9l);
sm1.put(p + "f002", 4l);
sm1.put(p + "f003", 2l);
sm1.put(p + "f004", 1l);
sm1.put(p + "f005", 19l);
sm1.put(EMITTED_STAT, 15l);
sm1.put(SEEN_STAT, 5l);
sm1.put(DELETES_IGNORED_STAT, 1l);
HashMap<String, Long> sm2 = new HashMap<>();
sm2.put(p + "f001", 1l);
sm2.put(p + "f002", 2l);
sm2.put(p + "f00a", 7l);
sm2.put(p + "f00b", 1l);
sm2.put(p + "f00c", 17l);
sm2.put(EMITTED_STAT, 18l);
sm2.put(SEEN_STAT, 6l);
sm2.put(DELETES_IGNORED_STAT, 2l);
countSum.combiner(sc).merge(sm1, sm2);
HashMap<String, Long> expected = new HashMap<>();
expected.put(p + "f001", 10l);
expected.put(p + "f002", 6l);
expected.put(p + "f005", 19l);
expected.put(p + "f00a", 7l);
expected.put(p + "f00c", 17l);
expected.put(TOO_LONG_STAT, 0l);
expected.put(TOO_MANY_STAT, 4l);
expected.put(EMITTED_STAT, 18l + 15l);
expected.put(SEEN_STAT, 6l + 5l);
expected.put(DELETES_IGNORED_STAT, 3l);
Assert.assertEquals(expected, sm1);
sm2.clear();
sm2.put(p + "f001", 19l);
sm2.put(p + "f002", 2l);
sm2.put(p + "f003", 3l);
sm2.put(p + "f00b", 13l);
sm2.put(p + "f00c", 2l);
sm2.put(TOO_LONG_STAT, 1l);
sm2.put(TOO_MANY_STAT, 3l);
sm2.put(EMITTED_STAT, 21l);
sm2.put(SEEN_STAT, 7l);
sm2.put(DELETES_IGNORED_STAT, 5l);
countSum.combiner(sc).merge(sm1, sm2);
expected.clear();
expected.put(p + "f001", 29l);
expected.put(p + "f002", 8l);
expected.put(p + "f005", 19l);
expected.put(p + "f00b", 13l);
expected.put(p + "f00c", 19l);
expected.put(TOO_LONG_STAT, 1l);
expected.put(TOO_MANY_STAT, 17l);
expected.put(EMITTED_STAT, 21l + 18 + 15);
expected.put(SEEN_STAT, 7l + 6 + 5);
expected.put(DELETES_IGNORED_STAT, 8l);
}
Aggregations