use of org.apache.accumulo.core.client.summary.SummarizerConfiguration in project accumulo by apache.
the class EntryLengthSummarizersTest method testBasicVisibility.
@Test
public void testBasicVisibility() {
SummarizerConfiguration sc = SummarizerConfiguration.builder(EntryLengthSummarizer.class).build();
EntryLengthSummarizer entrySum = new EntryLengthSummarizer();
Key k1 = new Key("r1", "f1", "q1", "v1");
Key k2 = new Key("r2", "f2", "q2", "v2");
Key k3 = new Key("r3", "f3", "q3", "v3");
Collector collector = entrySum.collector(sc);
collector.accept(k1, new Value(""));
collector.accept(k2, new Value(""));
collector.accept(k3, new Value(""));
HashMap<String, Long> stats = new HashMap<>();
collector.summarize(stats::put);
HashMap<String, Long> expected = new HashMap<>();
expected.put("key.min", 8L);
expected.put("key.max", 8L);
expected.put("key.sum", 24L);
// Log2 Histogram
expected.put("key.logHist.3", 3L);
expected.put("row.min", 2L);
expected.put("row.max", 2L);
expected.put("row.sum", 6L);
// Log2 Histogram
expected.put("row.logHist.1", 3L);
expected.put("family.min", 2L);
expected.put("family.max", 2L);
expected.put("family.sum", 6L);
// Log2 Histogram
expected.put("family.logHist.1", 3L);
expected.put("qualifier.min", 2L);
expected.put("qualifier.max", 2L);
expected.put("qualifier.sum", 6L);
// Log2 Histogram
expected.put("qualifier.logHist.1", 3L);
expected.put("visibility.min", 2L);
expected.put("visibility.max", 2L);
expected.put("visibility.sum", 6L);
// Log2 Histogram
expected.put("visibility.logHist.1", 3L);
expected.put("value.min", 0L);
expected.put("value.max", 0L);
expected.put("value.sum", 0L);
// Log2 Histogram
expected.put("value.logHist.0", 3L);
expected.put("total", 3L);
Assert.assertEquals(expected, stats);
}
use of org.apache.accumulo.core.client.summary.SummarizerConfiguration in project accumulo by apache.
the class EntryLengthSummarizersTest method testBasicQualifier.
@Test
public void testBasicQualifier() {
SummarizerConfiguration sc = SummarizerConfiguration.builder(EntryLengthSummarizer.class).build();
EntryLengthSummarizer entrySum = new EntryLengthSummarizer();
Key k1 = new Key("r1", "f1", "q1");
Key k2 = new Key("r2", "f2", "q2");
Key k3 = new Key("r3", "f3", "q3");
Collector collector = entrySum.collector(sc);
collector.accept(k1, new Value(""));
collector.accept(k2, new Value(""));
collector.accept(k3, new Value(""));
HashMap<String, Long> stats = new HashMap<>();
collector.summarize(stats::put);
HashMap<String, Long> expected = new HashMap<>();
expected.put("key.min", 6L);
expected.put("key.max", 6L);
expected.put("key.sum", 18L);
// Log2 Histogram
expected.put("key.logHist.3", 3L);
expected.put("row.min", 2L);
expected.put("row.max", 2L);
expected.put("row.sum", 6L);
// Log2 Histogram
expected.put("row.logHist.1", 3L);
expected.put("family.min", 2L);
expected.put("family.max", 2L);
expected.put("family.sum", 6L);
// Log2 Histogram
expected.put("family.logHist.1", 3L);
expected.put("qualifier.min", 2L);
expected.put("qualifier.max", 2L);
expected.put("qualifier.sum", 6L);
// Log2 Histogram
expected.put("qualifier.logHist.1", 3L);
expected.put("visibility.min", 0L);
expected.put("visibility.max", 0L);
expected.put("visibility.sum", 0L);
// Log2 Histogram
expected.put("visibility.logHist.0", 3L);
expected.put("value.min", 0L);
expected.put("value.max", 0L);
expected.put("value.sum", 0L);
// Log2 Histogram
expected.put("value.logHist.0", 3L);
expected.put("total", 3L);
Assert.assertEquals(expected, stats);
}
use of org.apache.accumulo.core.client.summary.SummarizerConfiguration in project accumulo by apache.
the class EntryLengthSummarizersTest method testComplexFamily.
@Test
public void testComplexFamily() {
SummarizerConfiguration sc = SummarizerConfiguration.builder(EntryLengthSummarizer.class).build();
EntryLengthSummarizer entrySum = new EntryLengthSummarizer();
Key k1 = new Key("r1", "family1");
Key k2 = new Key("row2", "columnFamily2");
Key k3 = new Key("columnRow3", "f3");
Collector collector = entrySum.collector(sc);
collector.accept(k1, new Value(""));
collector.accept(k2, new Value(""));
collector.accept(k3, new Value(""));
HashMap<String, Long> stats = new HashMap<>();
collector.summarize(stats::put);
HashMap<String, Long> expected = new HashMap<>();
expected.put("key.min", 9L);
expected.put("key.max", 17L);
expected.put("key.sum", 38L);
// Log2 Histogram
expected.put("key.logHist.3", 1L);
expected.put("key.logHist.4", 2L);
expected.put("row.min", 2L);
expected.put("row.max", 10L);
expected.put("row.sum", 16L);
// Log2 Histogram
expected.put("row.logHist.1", 1L);
expected.put("row.logHist.2", 1L);
expected.put("row.logHist.3", 1L);
expected.put("family.min", 2L);
expected.put("family.max", 13L);
expected.put("family.sum", 22L);
// Log2 Histogram
expected.put("family.logHist.1", 1L);
expected.put("family.logHist.3", 1L);
expected.put("family.logHist.4", 1L);
expected.put("qualifier.min", 0L);
expected.put("qualifier.max", 0L);
expected.put("qualifier.sum", 0L);
// Log2 Histogram
expected.put("qualifier.logHist.0", 3L);
expected.put("visibility.min", 0L);
expected.put("visibility.max", 0L);
expected.put("visibility.sum", 0L);
// Log2 Histogram
expected.put("visibility.logHist.0", 3L);
expected.put("value.min", 0L);
expected.put("value.max", 0L);
expected.put("value.sum", 0L);
// Log2 Histogram
expected.put("value.logHist.0", 3L);
expected.put("total", 3L);
Assert.assertEquals(expected, stats);
}
use of org.apache.accumulo.core.client.summary.SummarizerConfiguration in project accumulo by apache.
the class EntryLengthSummarizersTest method testLog2Histogram.
@Test
public void testLog2Histogram() {
SummarizerConfiguration sc = SummarizerConfiguration.builder(EntryLengthSummarizer.class).build();
EntryLengthSummarizer entrySum = new EntryLengthSummarizer();
Key k1 = new Key("row1");
Key k2 = new Key("row2");
Key k3 = new Key("row3");
Collector collector = entrySum.collector(sc);
collector.accept(k1, new Value("01"));
collector.accept(k2, new Value("012345678"));
collector.accept(k3, new Value("012345679"));
HashMap<String, Long> stats = new HashMap<>();
collector.summarize(stats::put);
HashMap<String, Long> expected = new HashMap<>();
expected.put("key.min", 4L);
expected.put("key.max", 4L);
expected.put("key.sum", 12L);
// Log2 Histogram for Key
expected.put("key.logHist.2", 3L);
expected.put("row.min", 4L);
expected.put("row.max", 4L);
expected.put("row.sum", 12L);
// Log2 Histogram for Row
expected.put("row.logHist.2", 3L);
expected.put("family.min", 0L);
expected.put("family.max", 0L);
expected.put("family.sum", 0L);
// Log2 Histogram for Family
expected.put("family.logHist.0", 3L);
expected.put("qualifier.min", 0L);
expected.put("qualifier.max", 0L);
expected.put("qualifier.sum", 0L);
// Log2 Histogram for Qualifier
expected.put("qualifier.logHist.0", 3L);
expected.put("visibility.min", 0L);
expected.put("visibility.max", 0L);
expected.put("visibility.sum", 0L);
// Log2 Histogram for Visibility
expected.put("visibility.logHist.0", 3L);
expected.put("value.min", 2L);
expected.put("value.max", 9L);
expected.put("value.sum", 20L);
// Log2 Histogram for Value
expected.put("value.logHist.1", 1L);
expected.put("value.logHist.3", 2L);
expected.put("total", 3L);
Assert.assertEquals(expected, stats);
}
use of org.apache.accumulo.core.client.summary.SummarizerConfiguration in project accumulo by apache.
the class EntryLengthSummarizersTest method testCombine3.
@Test
public void testCombine3() {
SummarizerConfiguration sc = SummarizerConfiguration.builder(EntryLengthSummarizer.class).build();
EntryLengthSummarizer entrySum = new EntryLengthSummarizer();
Collector collector1 = entrySum.collector(sc);
collector1.accept(new Key("r1", "f1"), new Value("v1"));
HashMap<String, Long> stats1 = new HashMap<>();
collector1.summarize(stats1::put);
Collector collector2 = entrySum.collector(sc);
collector2.accept(new Key("row1", "family1", "q1"), new Value(""));
HashMap<String, Long> stats2 = new HashMap<>();
collector2.summarize(stats2::put);
Combiner combiner = entrySum.combiner(sc);
combiner.merge(stats1, stats2);
HashMap<String, Long> expected = new HashMap<>();
expected.put("key.min", 4L);
expected.put("key.max", 13L);
expected.put("key.sum", 17L);
// Log2 Histogram for Key
expected.put("key.logHist.2", 1L);
expected.put("key.logHist.4", 1L);
expected.put("row.min", 2L);
expected.put("row.max", 4L);
expected.put("row.sum", 6L);
// Log2 Histogram for Row
expected.put("row.logHist.1", 1L);
expected.put("row.logHist.2", 1L);
expected.put("family.min", 2L);
expected.put("family.max", 7L);
expected.put("family.sum", 9L);
// Log2 Histogram for Family
expected.put("family.logHist.1", 1L);
expected.put("family.logHist.3", 1L);
expected.put("qualifier.min", 0L);
expected.put("qualifier.max", 2L);
expected.put("qualifier.sum", 2L);
// Log2 Histogram for Qualifier
expected.put("qualifier.logHist.0", 1L);
expected.put("qualifier.logHist.1", 1L);
expected.put("visibility.min", 0L);
expected.put("visibility.max", 0L);
expected.put("visibility.sum", 0L);
// Log2 Histogram for Visibility
expected.put("visibility.logHist.0", 2L);
expected.put("value.min", 0L);
expected.put("value.max", 2L);
expected.put("value.sum", 2L);
// Log2 Histogram for Value
expected.put("value.logHist.0", 1L);
expected.put("value.logHist.1", 1L);
expected.put("total", 2L);
Assert.assertEquals(expected, stats1);
}
Aggregations