Skip to content

Commit

Permalink
Fix summarizer bug with empty loc group
Browse files Browse the repository at this point in the history
For a table with multiple locality groups and a locality group with no data,
feching summaries would fail.  Found this while working on apache/fluo#1054
  • Loading branch information
keith-turner committed Oct 17, 2018
1 parent c095e86 commit b96cf61
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,10 @@ private static class LgSummaries {

boolean exceedsRange(Text startRow, Text endRow) {

if (summaries.length == 0) {
return false;
}

Text lastRow = summaries[summaries.length - 1].lastRow;
if (startRow != null && firstRow.compareTo(startRow) <= 0
&& startRow.compareTo(lastRow) < 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -717,13 +717,15 @@ public void testLocalityGroups() throws Exception {
SummarizerConfiguration sc1 = SummarizerConfiguration.builder(FamilySummarizer.class).build();
SummarizerConfiguration sc2 = SummarizerConfiguration.builder(BasicSummarizer.class).build();
ntc.enableSummarization(sc1, sc2);
c.tableOperations().create(table, ntc);

Map<String,Set<Text>> lgroups = new HashMap<>();
lgroups.put("lg1", ImmutableSet.of(new Text("chocolate"), new Text("coffee")));
lgroups.put("lg2", ImmutableSet.of(new Text(" broccoli "), new Text("cabbage")));
// create a locality group that will not have data in it
lgroups.put("lg3", ImmutableSet.of(new Text(" apple "), new Text("orange")));

c.tableOperations().setLocalityGroups(table, lgroups);
ntc.setLocalityGroups(lgroups);
c.tableOperations().create(table, ntc);

Map<Key,Value> expected = new HashMap<>();
try (BatchWriter bw = c.createBatchWriter(table, new BatchWriterConfig())) {
Expand Down

0 comments on commit b96cf61

Please sign in to comment.