[SERVER-6551] $avg can miss results from shards that return double values Created: 21/Jul/12  Updated: 15/Aug/12  Resolved: 01/Aug/12

Status: Closed
Project: Core Server
Component/s: Aggregation Framework
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Aaron Staple Assignee: Aaron Staple
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

If group gets a result from a shard that returns a long value, it will set totalType to NumberLong and may fail to include previously read double values when calculating the average.

Test (based on other unit test base classes):

            /* Router result for a double and a long. */
            class DoubleLong : public TwoOperandBase {
                BSONObj operand1() {
                    return BSON( "d" << BSON( "subTotal" << 5.0 << "count" << 2 ) );
                }
                BSONObj operand2() {
                    return BSON( "d" << BSON( "subTotal" << 6LL << "count" << 1 ) );
                }
                BSONObj expectedResult() { return BSON( "" << 11.0/3 ); }
            };

Actual result is 2.0 since the 5.0 value is not added to the total.



 Comments   
Comment by auto [ 01/Aug/12 ]

Author:

{u'date': u'2012-07-27T15:11:03-07:00', u'email': u'aaron@10gen.com', u'name': u'Aaron'}

Message: SERVER-6551 was fixed by SERVER-6275 changes. Update tests to reflect new behavior.
Branch: master
https://github.com/mongodb/mongo/commit/ac2f2b228f12a3a541639e34cd4d8df62bf31351

Generated at Thu Feb 08 03:12:02 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.