[SERVER-6192] $and and $or expressions may not short circuit non constants and optimize to a constant if the original expression has only one constant Created: 24/Jun/12 Updated: 11/Jul/16 Resolved: 02/Oct/13 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Aggregation Framework |
| Affects Version/s: | None |
| Fix Version/s: | 2.5.3 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Aaron Staple | Assignee: | David Storch |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Participants: | |||||||||
| Description |
|
Observed behavior: A $and/$or expression with a single constant is not optimized as well as a similar expression with two constants. ExpressionAnd::optimize() and ExpressionOr::optimize() expect that any constant will appear in the last operand, but ExpressionNary::optimize() does not guarantee placement of a constant in the last operand if there was only one constant to begin with.
Test:
|
| Comments |
| Comment by auto [ 02/Oct/13 ] |
|
Author: {u'username': u'dannenberg', u'name': u'Matt Dannenberg', u'email': u'matt.dannenberg@10gen.com'}Message: Merge pull request #509 from dstorch/master
|
| Comment by auto [ 02/Oct/13 ] |
|
Author: {u'username': u'dstorch', u'name': u'David Storch', u'email': u'david.storch@10gen.com'}Message: |
| Comment by David Storch [ 01/Oct/13 ] |
| Comment by Mathias Stearn [ 30/Sep/13 ] |
|
As part of QA-374, could you write a test for this case? I've manually validated that we do the right thing with these now but would like to have an automated test before closing this ticket. |
| Comment by Daniel Pasette (Inactive) [ 17/Sep/13 ] |
|
redbeard0531, can you add a test for this case? |