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

$const folding in $add expression in $bucketAuto groupBy changes number of buckets

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

      See linked repro test file + comment on linked BF- this is a reduced version of the linked fuzzer failure.

      Show
      See linked repro test file + comment on linked BF- this is a reduced version of the linked fuzzer failure.
    • 24

       

      {$bucketAuto: {
         groupBy: {$add: [
            {$const: {NumberLong("9223372036854775807")}},
            "$measurement7",
            {$const: 24784}]},
         buckets: 5,
      }}
      

      optimizes to:

      {$bucketAuto: {
         groupBy: {$add: ["$measurement7", {$const: 9223372036854800000}]},
         buckets: 5,
      }}
      

      which ends up producing just one bucket instead of two.

       

            Assignee:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            alya.berciu@mongodb.com Alya Berciu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: