Skip to content

Commit 0c18f7e

Browse files
ajleong623rgsriram
authored andcommitted
Cardinality Aggregation dynamic pruning NPE catch (opensearch-project#17775)
* Update CardinalityAggregator.java Signed-off-by: ajleong623 <[email protected]> * Signed-off-by: Anthony Leong <[email protected]> Signed-off-by: ajleong623 <[email protected]> * Update CardinalityAggregator.java Signed-off-by: ajleong623 <[email protected]> * Checked Cardinality Aggregation dynamic pruning null pointer exception Signed-off-by: Anthony Leong <[email protected]> Signed-off-by: ajleong623 <[email protected]> --------- Signed-off-by: ajleong623 <[email protected]> Signed-off-by: Sriram Ganesh <[email protected]>
1 parent 0166afd commit 0c18f7e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

server/src/main/java/org/opensearch/search/aggregations/metrics/CardinalityAggregator.java

+6
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,13 @@ public void collect(int doc, long owningBucketOrd) throws IOException {
381381
* Note: the queue may be empty or the queue top may be null after pruning
382382
*/
383383
private void prune(int doc) {
384+
if (queue.size() == 0) {
385+
return;
386+
}
384387
DisiWrapper top = queue.top();
388+
if (top == null) {
389+
return;
390+
}
385391
int curTopDoc = top.doc;
386392
if (curTopDoc == doc) {
387393
do {

0 commit comments

Comments
 (0)