Search in sources :

Example 1 with FileSummary

use of org.apache.accumulo.core.summary.SummaryCollection.FileSummary in project accumulo by apache.

the class SummaryCollectionTest method testDeleted.

@Test
public void testDeleted() {
    SummarizerConfiguration conf = SummarizerConfiguration.builder(FamilySummarizer.class).build();
    HashMap<String, Long> stats = new HashMap<>();
    stats.put("c:foo", 9L);
    FileSummary fs1 = new FileSummary(conf, stats, false);
    SummaryCollection sc1 = new SummaryCollection(Collections.singleton(fs1));
    stats = new HashMap<>();
    stats.put("c:foo", 5L);
    stats.put("c:bar", 3L);
    FileSummary fs2 = new FileSummary(conf, stats, true);
    SummaryCollection sc2 = new SummaryCollection(Collections.singleton(fs2));
    SummaryCollection sc3 = new SummaryCollection(Collections.emptyList());
    SummaryCollection sc4 = new SummaryCollection(Collections.emptyList(), true);
    SummarizerFactory factory = new SummarizerFactory();
    SummaryCollection mergeSc = new SummaryCollection();
    for (SummaryCollection sc : Arrays.asList(sc1, sc2, sc3, sc4, sc4)) {
        mergeSc.merge(sc, factory);
    }
    for (SummaryCollection sc : Arrays.asList(mergeSc, new SummaryCollection(mergeSc.toThrift()))) {
        List<Summary> summaries = sc.getSummaries();
        Assert.assertEquals(1, summaries.size());
        Summary summary = summaries.get(0);
        FileStatistics filestats = summary.getFileStatistics();
        Assert.assertEquals(5, filestats.getTotal());
        Assert.assertEquals(1, filestats.getExtra());
        Assert.assertEquals(0, filestats.getLarge());
        Assert.assertEquals(1, filestats.getMissing());
        Assert.assertEquals(2, filestats.getDeleted());
        Assert.assertEquals(4, filestats.getInaccurate());
    }
}
Also used : FileStatistics(org.apache.accumulo.core.client.summary.Summary.FileStatistics) HashMap(java.util.HashMap) FamilySummarizer(org.apache.accumulo.core.client.summary.summarizers.FamilySummarizer) FileSummary(org.apache.accumulo.core.summary.SummaryCollection.FileSummary) FileSummary(org.apache.accumulo.core.summary.SummaryCollection.FileSummary) Summary(org.apache.accumulo.core.client.summary.Summary) SummarizerConfiguration(org.apache.accumulo.core.client.summary.SummarizerConfiguration) Test(org.junit.Test)

Aggregations

HashMap (java.util.HashMap)1 SummarizerConfiguration (org.apache.accumulo.core.client.summary.SummarizerConfiguration)1 Summary (org.apache.accumulo.core.client.summary.Summary)1 FileStatistics (org.apache.accumulo.core.client.summary.Summary.FileStatistics)1 FamilySummarizer (org.apache.accumulo.core.client.summary.summarizers.FamilySummarizer)1 FileSummary (org.apache.accumulo.core.summary.SummaryCollection.FileSummary)1 Test (org.junit.Test)1