[SERVER-42854] $avg with Infinity can incorrectly return NaN Created: 16/Aug/19 Updated: 06/Dec/22 Resolved: 19/Oct/21 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Nicholas Zolnierz | Assignee: | Backlog - Query Optimization |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | query-44-grooming | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Assigned Teams: |
Query Optimization
|
||||||||||||
| Operating System: | ALL | ||||||||||||
| Steps To Reproduce: | *On a debug build, to ensure we always spill to disk*
|
||||||||||||
| Participants: | |||||||||||||
| Linked BF Score: | 50 | ||||||||||||
| Description |
|
When adding Infinity to any value using the DoubleDoubleSummation class, the _addend double is calculated to be NaN. This is probably fine, however getting the result of the summation here results in a value of Infinity with an error of NaN. If this happens when the $avg accumulator spills to disk, we will attempt to process the NaN error as if its a finite value and as a result the accumulator evaluates to NaN. |
| Comments |
| Comment by David Percy [ 19/Oct/21 ] |
|
Looks like the same bug as SERVER-37429. |
| Comment by Geert Bosch [ 03/Sep/19 ] |
|
nicholas.zolnierz, your fix looks correct to me. Indeed the idea behind the _special member was to correctly handle all the non-finite corner cases by doing the same that a simple (non-double-double) summation would return if that more accurate mechanism results in special (non-finite) values in any way. |
| Comment by Charlie Swanson [ 22/Aug/19 ] |
|
Putting this on the backlog because our understanding is that we will soon disable testing of debug vs. non-debug builds and this will stop being a problem in the build. It is still a bug though, so leaving it open. cc robert.guo |