[SERVER-67011] $const folding in $add expression in $bucketAuto groupBy changes number of buckets Created: 03/Jun/22  Updated: 06/Dec/22  Resolved: 08/Jun/22

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

Type: Bug Priority: Major - P3
Reporter: Alya Berciu Assignee: Backlog - Query Optimization
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File agg_fuzzer-5ec9-1654237153413-2.js    
Issue Links:
Depends
Problem/Incident
is caused by SERVER-63099 Constant folding should not assume ar... Closed
Assigned Teams:
Query Optimization
Operating System: ALL
Steps To Reproduce:

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

Participants:
Linked BF Score: 24

 Description   

 

{$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.

 



 Comments   
Comment by Steve Tarzia [ 08/Jun/22 ]

davis.haupt@mongodb.com thinks this will be fixed by https://jira.mongodb.org/browse/SERVER-63099.

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