Skip to content

Commit

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

Relates #22278
  • Loading branch information
tlrx committed Jan 20, 2017
1 parent 12d7ec2 commit f7dc7e2
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 f7dc7e2

Please sign in to comment.