Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-61679

$sum accumulator fails in aggregation_wildcard_fuzzer when numeric data set is mixed typed and precision is too wide

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • ALL
    • Hide

      In one window, execute the following.

      $ build/debug/install/bin/mongod --setParameter featureFlagSBEGroupPushdown=true
      

      In another windows, execute the following.

      $ build/debug/install/bin/mongo
      MongoDB Enterprise > db.tt.drop();
      true
      MongoDB Enterprise > db.tt.insert([{n: NumberLong("9223372036854775807")}, {n: NumberDecimal("1.0")}]);
      BulkWriteResult({
      	"writeErrors" : [ ],
      	"writeConcernErrors" : [ ],
      	"nInserted" : 2,
      	"nUpserted" : 0,
      	"nMatched" : 0,
      	"nModified" : 0,
      	"nRemoved" : 0,
      	"upserted" : [ ]
      })
      MongoDB Enterprise > db.tt.aggregate([{$group: {_id: null, num : {$sum: {$add: [NumberLong("1000"), "$n"]}}}}]);
      { "_id" : null, "num" : NumberDecimal("9223372036854777808.0") }
      MongoDB Enterprise > db.adminCommand({setParameter: 1, internalQueryForceClassicEngine: true});
      { "was" : false, "ok" : 1 }
      MongoDB Enterprise > db.tt.aggregate([{$group: {_id: null, num : {$sum: {$add: [NumberLong("1000"), "$n"]}}}}]);
      { "_id" : null, "num" : NumberDecimal("9223372036854776809.0") }
      
      Show
      In one window, execute the following. $ build/debug/install/bin/mongod --setParameter featureFlagSBEGroupPushdown= true In another windows, execute the following. $ build/debug/install/bin/mongo MongoDB Enterprise > db.tt.drop(); true MongoDB Enterprise > db.tt.insert([{n: NumberLong( "9223372036854775807" )}, {n: NumberDecimal( "1.0" )}]); BulkWriteResult({ "writeErrors" : [ ], "writeConcernErrors" : [ ], "nInserted" : 2, "nUpserted" : 0, "nMatched" : 0, "nModified" : 0, "nRemoved" : 0, "upserted" : [ ] }) MongoDB Enterprise > db.tt.aggregate([{$group: {_id: null , num : {$sum: {$add: [NumberLong( "1000" ), "$n" ]}}}}]); { "_id" : null , "num" : NumberDecimal( "9223372036854777808.0" ) } MongoDB Enterprise > db.adminCommand({setParameter: 1, internalQueryForceClassicEngine: true }); { "was" : false , "ok" : 1 } MongoDB Enterprise > db.tt.aggregate([{$group: {_id: null , num : {$sum: {$add: [NumberLong( "1000" ), "$n" ]}}}}]); { "_id" : null , "num" : NumberDecimal( "9223372036854776809.0" ) }
    • QE 2021-11-29, QE 2021-12-13, QE 2021-12-27, QE 2022-01-10, QE 2022-01-24

      As can be seen in the attached repro script, when a numeric data set is mixed-typed and the precision is too wide so that int64 can't express any intermediate result, the SBE engine result does not agree with the classic engine result. Results are...

      MongoDB Enterprise > db.tt.aggregate([{$group: {_id: null, num : {$sum: {$add: [NumberLong("1000"), "$n"]}}}}]);
      { "_id" : null, "num" : NumberDecimal("9223372036854777808.0") }
      MongoDB Enterprise > db.adminCommand({setParameter: 1, internalQueryForceClassicEngine: true});
      { "was" : false, "ok" : 1 }
      MongoDB Enterprise > db.tt.aggregate([{$group: {_id: null, num : {$sum: {$add: [NumberLong("1000"), "$n"]}}}}]);
      { "_id" : null, "num" : NumberDecimal("9223372036854776809.0") }
      

            Assignee:
            yoonsoo.kim@mongodb.com Yoon Soo Kim
            Reporter:
            yoonsoo.kim@mongodb.com Yoon Soo Kim
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: