[SERVER-56719] Short circuit $switch when any condition is constant Created: 06/May/21 Updated: 29/Oct/23 Resolved: 08/Jul/21 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 5.1.0-rc0 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | David Percy | Assignee: | Naama Bareket |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | neweng | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||
| Backport Requested: |
v5.2, v4.4, v4.2
|
||||||||||||||||||||
| Sprint: | Query Optimization 2021-06-14, Query Optimization 2021-06-28, Query Optimization 2021-07-12 | ||||||||||||||||||||
| Participants: | |||||||||||||||||||||
| Linked BF Score: | 195 | ||||||||||||||||||||
| Description |
|
There are several rules we can add to $switch to improve its constant folding:
Alternatively, we could desugar $switch to chain of $cond expressions; then Either option would let $bucket take advantage of a $group-by-constant optimization, since $bucket desugars to $group + $switch. (Although I don't think we have a $group-by-constant optimization currently.) |
| Comments |
| Comment by Sviatlana Zuiko [ 03/Feb/22 ] |
|
Sorry, it was my bad, I got confused. Declined BACKPORT-11790. |
| Comment by Mohammad Dashti (Inactive) [ 02/Feb/22 ] |
|
sviatlana.zuiko wasn't this applied to 5.1? Then, it should be already in 5.2, right? |
| Comment by Sviatlana Zuiko [ 02/Feb/22 ] |
|
Requesting a backport to 5.2 because of new failure occurrence there https://buildbaron.corp.mongodb.com/ui/#/bfg/BFG-1038308 |
| Comment by Vivian Ge (Inactive) [ 06/Oct/21 ] |
|
Updating the fixversion since branching activities occurred yesterday. This ticket will be in rc0 when it’s been triggered. For more active release information, please keep an eye on #server-release. Thank you! |
| Comment by Githook User [ 07/Jul/21 ] |
|
Author: {'name': 'Naama Bareket', 'email': 'naama.bareket@mongodb.com', 'username': 'naama-bareket'}Message: |
| Comment by Mohammad Dashti (Inactive) [ 02/Jul/21 ] |
|
Based on BF-21717, this needs to be back-ported to v4.2 and v4.4 to avoid fuzzer failures. |
| Comment by Githook User [ 30/Jun/21 ] |
|
Author: {'name': 'samontea', 'email': 'merciers.merciers@gmail.com', 'username': 'samontea'}Message: Revert " |
| Comment by Githook User [ 29/Jun/21 ] |
|
Author: {'name': 'Naama Bareket', 'email': 'naama.bareket@mongodb.com', 'username': 'naama-bareket'}Message: |
| Comment by Githook User [ 23/Jun/21 ] |
|
Author: {'name': 'Naama Bareket', 'email': 'naama.bareket@mongodb.com', 'username': 'naama-bareket'}Message: |
| Comment by Githook User [ 23/Jun/21 ] |
|
Author: {'name': 'Naama Bareket', 'email': 'naama.bareket@mongodb.com', 'username': 'naama-bareket'}Message: |
| Comment by Githook User [ 23/Jun/21 ] |
|
Author: {'name': 'Naama Bareket', 'email': 'naama.bareket@mongodb.com', 'username': 'naama-bareket'}Message: |
| Comment by Githook User [ 23/Jun/21 ] |
|
Author: {'name': 'Naama Bareket', 'email': 'naama.bareket@mongodb.com', 'username': 'naama-bareket'}Message: |
| Comment by Githook User [ 23/Jun/21 ] |
|
Author: {'name': 'Naama Bareket', 'email': 'naama.bareket@mongodb.com', 'username': 'naama-bareket'}Message: |
| Comment by Githook User [ 23/Jun/21 ] |
|
Author: {'name': 'Naama Bareket', 'email': 'naama.bareket@mongodb.com', 'username': 'naama-bareket'}Message: |
| Comment by Githook User [ 23/Jun/21 ] |
|
Author: {'name': 'Naama Bareket', 'email': 'naama.bareket@mongodb.com', 'username': 'naama-bareket'}Message: |