Integer overflow in total count in grouping results [LUCENE-9302]
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 1.4k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 88
Description
When doing a Grouping search in solr cloud you can get a negative number for the total found.
This is caused by the accumulated total being held in an integer and not a long.
example result:
` "responseHeader": { "status": 0, "QTime": 9231, "params": { "q": "decade:200", "indent": "true", "fl": "decade", "wt": "json", "group.field": "decade", "group": "true", "_": "1542773674247" } }, "grouped": { "decade": { "matches": -629516788, "groups": [ { "groupValue": "200", "doclist": { "numFound": -629516788, "start": 0, "maxScore": 1.9315376, "docs": [ { "decade": "200" } ] } } ] } } `}
`result without grouping:`
` "responseHeader": { "status": 0, "QTime": 1063, "params": { "q": "decade:200", "indent": "true", "fl": "decade", "wt": "json", "_": "1542773791855" } }, "response": { "numFound": 3665450508, "start": 0, "maxScore": 1.9315376, "docs": [ { "decade": "200" }, { "decade": "200" }, { "decade": "200" }, { "decade": "200" }, { "decade": "200" }, { "decade": "200" }, { "decade": "200" }, { "decade": "200" }, { "decade": "200" }, { "decade": "200" } ] } `}
---
Migrated from [LUCENE-9302](https://issues.apache.org/jira/browse/LUCENE-9302) by Ian, 1 vote, updated Apr 06 2020
Attachments: [SOLR-13004.patch](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-9302/SOLR-13004.patch) (versions: 2)
Linked issues:
- [SOLR-14381](https://issues.apache.org/jira/browse/SOLR-14381)
Contributor guide
Research direction
Start by reviewing the attached SOLR-13004.patch and locating the grouping-search implementation responsible for accumulated totals. Reproduce the reported grouped versus ungrouped count discrepancy; done when grouped totals remain correct beyond the integer range, with appropriate regression coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, search
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100