Histogram stats types are incorrect

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • ALL
    • Hide

      On a mongod with the following parameters set:

      mongod --setParameter enableTestCommands=true --setParameter featureFlagCommonQueryFramework=true --setParameter internalQueryFrameworkControl=tryBonsai

      Run the following:

       

      db.coll.createIndex({a: 1});
      db.coll.insertMany([{a: 1}, {a: 2}, {a: 2}, {a: 3}, {a: 3}, {a: 3}]);
      
      db.runCommand({analyze: "coll", key: "a"}); 

       
       
      At this point, the stats collection should be initialized correctly. Now run the following to force HistogramCE to be used:

       

      db.adminCommand({setParameter: 1, internalQueryCardinalityEstimatorMode: "histogram"})
      db.adminCommand({setParameter: 1, internalQueryFrameworkControl: "forceBonsai"})  

       
       
      This results in the following command failing:

      db.coll.aggregate({$match: {a: 1}});
      > Error: error: {
              "ok" : 0,
              "errmsg" : "Error getting histograms for path test.test : aBSON field 'StatsPath.statistics.documents' is the wrong type 'int', expected type 'long'",
              "code" : 14,
              "codeName" : "TypeMismatch"
      }
      Show
      On a mongod with the following parameters set: mongod --setParameter enableTestCommands=true --setParameter featureFlagCommonQueryFramework=true --setParameter internalQueryFrameworkControl=tryBonsai Run the following:   db.coll.createIndex({a: 1}); db.coll.insertMany([{a: 1}, {a: 2}, {a: 2}, {a: 3}, {a: 3}, {a: 3}]); db.runCommand({analyze: "coll", key: "a"});     At this point, the stats collection should be initialized correctly. Now run the following to force HistogramCE to be used:   db.adminCommand({setParameter: 1, internalQueryCardinalityEstimatorMode: "histogram"}) db.adminCommand({setParameter: 1, internalQueryFrameworkControl: "forceBonsai"})     This results in the following command failing: db.coll.aggregate({$match: {a: 1}}); > Error: error: { "ok" : 0, "errmsg" : "Error getting histograms for path test.test : aBSON field 'StatsPath.statistics.documents' is the wrong type 'int', expected type 'long'", "code" : 14, "codeName" : "TypeMismatch" }
    • QO 2022-10-31
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      See the steps to reproduce. Note that it is possible to make the error go away by changing all bucket field types to double and the documents field type to int in ce/stats.idl; however, this may not be the correct fix.

            Assignee:
            Misha Tyulenev (Inactive)
            Reporter:
            Alya Berciu
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: