Skip to content

Commit

Permalink
Add unit tests for DateHistogramAggregator
Browse files Browse the repository at this point in the history
Adds unit tests for the date histogram aggregator.

Relates elastic#22278
  • Loading branch information
tlrx committed Jan 20, 2017
1 parent 5d806bf commit e6584be
Show file tree
Hide file tree
Showing 2 changed files with 411 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,13 @@ protected <A extends InternalAggregation, C extends Aggregator> A searchAndReduc
aggs.add(a.buildAggregation(0L));
}
}
@SuppressWarnings("unchecked")
A internalAgg = (A) aggs.get(0).doReduce(aggs,
new InternalAggregation.ReduceContext(root.context().bigArrays(), null));
return internalAgg;
if (aggs.isEmpty()) {
return null;
} else {
@SuppressWarnings("unchecked")
A internalAgg = (A) aggs.get(0).doReduce(aggs, new InternalAggregation.ReduceContext(root.context().bigArrays(), null));
return internalAgg;
}
}
}

Expand Down

0 comments on commit e6584be

Please sign in to comment.