Skip to content

Commit ec999ea

Browse files
committed
Addressing test failures due to NPE
Signed-off-by: Ankit Jain <jainankitk@apache.org>
1 parent f031019 commit ec999ea

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

server/src/main/java/org/opensearch/search/aggregations/bucket/filterrewrite/rangecollector/SubAggRangeCollector.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,13 @@ public boolean hasSubAgg() {
6666
return true;
6767
}
6868

69+
private boolean isDocLive(int docId) {
70+
return liveDocs == null || liveDocs.get(docId);
71+
}
72+
6973
@Override
7074
public void collectDocId(int docId) {
71-
if (liveDocs.get(docId)) {
75+
if (isDocLive(docId)) {
7276
bitSet.set(docId);
7377
}
7478
}
@@ -78,7 +82,7 @@ public void collectDocIdSet(DocIdSetIterator iter) throws IOException {
7882
// Explicitly OR iter intoBitSet to filter out deleted docs
7983
iter.nextDoc();
8084
for (int doc = iter.docID(); doc < DocIdSetIterator.NO_MORE_DOCS; doc = iter.nextDoc()) {
81-
if (liveDocs.get(doc)) {
85+
if (isDocLive(doc)) {
8286
bitSet.set(doc);
8387
}
8488
}

0 commit comments

Comments
 (0)