-
Notifications
You must be signed in to change notification settings - Fork 2k
Cardinality Aggregation dynamic pruning null pointer exception #17739
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@bowenlan-amzn - Thanks for reporting this issue. We should prioritize the fix for this NPE issue. Is someone working on it already? If yes, I can assign this issue |
@jainankitk no one has started on this for now. |
I would like to work on this. |
@bowenlan-amzn I made a draft pull request, but I am curious about what request caused this null pointer exception? And what were the documents? |
@ajleong623 I don't have a dataset for reproduction as it's from an internal customer. The request looks like this
I realise you probably anyway need to have a unit test case to hit the null check added in the PR so to pass the code coverage check. |
@bowenlan-amzn Ok, So I have been trying to write tests using the boolean query and have been looking through the logic of how dynamic pruning happens and what could cause the DISIPriorityQueue to become empty while documents are still being collected (I believe this is why the error occurred unless there was somehow a null value pushed onto the queue). However, I also noticed that the query you provided above would be evaluated in the conjunction scorer because multiple filter boolean queries would end of being conjunctive. But BooleanScorer (shown in the stack trace) is used for disjunctive queries. Is it certain that the query was in that structure? Also, when I tried experimenting with disjunctive queries by using the SHOULD occur value, the DISIPriorityQueue pushed documentIDs with values of -1 onto the queue, and from my experimenting, this will happen if I used a disjunctive query with only should boolean occurs for the clauses. When the -1 are pushed onto the queue, the queue cannot be emptied. I also tried to make a TermInSetQuery, and the same thing happened to the priority queue. Let me know if you have any other ideas on how I should try to reproduce the NPE. Are there any other boolean query structures I should try? How could I empty the queue but still have documents being collected when the queue is the size of the amount of terms in the query during construction of the collector? |
Based on the exception trace, I looked into the BooleanScorer's implementation. For unit test coverage, @ajleong623 maybe try create a customized BulkScorer to just hit the null check path. Or try ask maintainer to merge the change overriding the coverage check. Since how we end up having a NPE is still a mystery. |
We got a report of null pointer exception when performing dynamic pruning in cardinality aggregation.
The exception looks like below
Notice the code path starts from BooleanScorer. This is missed during development where we focused mostly just on DefaultBulkScorer. Although DefaultBulkScorer guarantee no NPE at that place, but the other implementations of BulkScorer may not have that guarantees.
The fix is to simply add a null check.
The text was updated successfully, but these errors were encountered: