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

$bucketAuto's granularity field should handle Infinity

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Querying
    • None
    • Query
    • ALL
    • Hide
      db.test.insert({num: Infinity});
      db.test.aggregate([{$bucketAuto: { groupBy: "$num", buckets: 1, granularity: "1-2-5"}}])
      
      Show
      db.test.insert({num: Infinity}); db.test.aggregate([{$bucketAuto: { groupBy: "$num" , buckets: 1, granularity: "1-2-5" }}])

      Running $bucketAuto with the granularity field set on a document containing infinity will cause the query to hang, likely due to the granularity rounder trying to repeatedly round up the boundary to infinity:

      [2020/01/08 01:44:09.973] #0  0x00007f3a2d7cdd60 in mongo::GranularityRounderPreferredNumbers::roundUp (this=this@entry=0x7f3a379da810, value=...) at /opt/mongodbtoolchain/revisions/23805b43dd027076b4ae48533ab385e20c61e0cf/stow/gcc-v3.Wsg/include/c++/8.2.0/bits/stl_iterator.h:841
      [2020/01/08 01:44:09.973] #1  0x00007f3a2d7257af in mongo::DocumentSourceBucketAuto::populateBuckets (this=0x7f3a36250c00) at src/mongo/db/exec/document_value/value.h:60
      [2020/01/08 01:44:09.973] #2  0x00007f3a2d727362 in mongo::DocumentSourceBucketAuto::doGetNext (this=0x7f3a36250c00) at src/mongo/db/pipeline/document_source_bucket_auto.cpp:98
      [2020/01/08 01:44:09.973] #3  0x00007f3a2d71d521 in mongo::DocumentSource::getNext (this=0x7f3a36250c00) at src/mongo/db/pipeline/document_source.cpp:98
      [2020/01/08 01:44:09.973] #4  0x00007f3a2d7998a7 in mongo::DocumentSourceRedact::doGetNext (this=0x7f3a379b0c20) at src/mongo/db/pipeline/document_source_redact.cpp:65
      [2020/01/08 01:44:09.973] #5  0x00007f3a2d71d521 in mongo::DocumentSource::getNext (this=0x7f3a379b0c20) at src/mongo/db/pipeline/document_source.cpp:98
      [2020/01/08 01:44:09.973] #6  0x00007f3a2d7bb1cc in mongo::Pipeline::getNext (this=0x7f3a377031b0) at /opt/mongodbtoolchain/revisions/23805b43dd027076b4ae48533ab385e20c61e0cf/stow/gcc-v3.Wsg/include/c++/8.2.0/bits/stl_list.h:1137
      [2020/01/08 01:44:09.973] #7  0x00007f3a2d5f4077 in mongo::PipelineProxyStage::getNext (this=<optimized out>) at /opt/mongodbtoolchain/revisions/23805b43dd027076b4ae48533ab385e20c61e0cf/stow/gcc-v3.Wsg/include/c++/8.2.0/bits/unique_ptr.h:342
      [2020/01/08 01:44:09.973] #8  0x00007f3a2d5f40ec in mongo::PipelineProxyStage::doWork (this=0x7f3a37345980, out=0x7f3a2bcb1348) at src/mongo/db/exec/pipeline_proxy.cpp:84
      [2020/01/08 01:44:09.973] #9  0x00007f3a2d5f4a38 in mongo::PlanStage::work (this=0x7f3a37345980, out=out@entry=0x7f3a2bcb1348) at src/mongo/db/exec/plan_stage.cpp:47
      [2020/01/08 01:44:09.973] #10 0x00007f3a2d633368 in mongo::PlanExecutorImpl::_getNextImpl (this=0x7f3a37915e00, objOut=0x7f3a2bcb1440, dlOut=0x0) at /opt/mongodbtoolchain/revisions/23805b43dd027076b4ae48533ab385e20c61e0cf/stow/gcc-v3.Wsg/include/c++/8.2.0/bits/unique_ptr.h:342
      [2020/01/08 01:44:09.973] #11 0x00007f3a2d633d2b in mongo::PlanExecutorImpl::getNext (this=<optimized out>, objOut=0x7f3a2bcb14e8, dlOut=<optimized out>) at src/mongo/db/query/plan_executor_impl.cpp:402
      [2020/01/08 01:44:09.973] #12 0x00007f3a2d3171ee in mongo::(anonymous namespace)::handleCursorCommand (opCtx=0x7f3a377a9040, nsForCursor=..., cursors=..., request=..., result=<optimized out>) at src/mongo/db/commands/run_aggregate.cpp:183
      [2020/01/08 01:44:09.973] #13 0x00007f3a2d31bfff in mongo::runAggregate (opCtx=opCtx@entry=0x7f3a377a9040, origNss=..., request=..., liteParsedPipeline=..., cmdObj=..., privileges=..., result=<optimized out>) at /opt/mongodbtoolchain/revisions/23805b43dd027076b4ae48533ab385e20c61e0cf/stow/gcc-v3.Wsg/include/c++/8.2.0/bits/move.h:182
      [2020/01/08 01:44:09.973] #14 0x00007f3a2d3116ec in mongo::(anonymous namespace)::PipelineCommand::Invocation::run (this=0x7f3a37a14200, opCtx=0x7f3a377a9040, reply=0x7f3a3773d270) at src/mongo/db/pipeline/aggregation_request.h:148
      

            Assignee:
            backlog-server-query Backlog - Query Team (Inactive)
            Reporter:
            robert.guo@mongodb.com Robert Guo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: