-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CSHARP-5446: Linq Aggregte Group(...) not support AddToSet #1599
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One question before I LGTM.
case AstUnaryOperator.Avg: accumulatorOperator = AstUnaryAccumulatorOperator.Avg; return true; | ||
case AstUnaryOperator.First: accumulatorOperator = AstUnaryAccumulatorOperator.First; return true; | ||
case AstUnaryOperator.Last: accumulatorOperator = AstUnaryAccumulatorOperator.Last; return true; | ||
case AstUnaryOperator.Max: accumulatorOperator = AstUnaryAccumulatorOperator.Max; return true; | ||
case AstUnaryOperator.Min: accumulatorOperator = AstUnaryAccumulatorOperator.Min; return true; | ||
case AstUnaryOperator.Push: accumulatorOperator = AstUnaryAccumulatorOperator.Push; return true; | ||
case AstUnaryOperator.SetUnion: accumulatorOperator = AstUnaryAccumulatorOperator.AddToSet; return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should add a similar mapping for SetIntersection
.
Even if we aren't currently generating any MQL with SetIntersection
it's a valid optimization.
SetUnion
and SetIntersection
with a single argument (i.e. the unary versions) are equivalent.
@@ -786,8 +786,8 @@ public void IGrouping_Distinct_of_root_should_work() | |||
var stages = Translate(collection, queryable); | |||
var expectedStages = new[] | |||
{ | |||
"{ $group : { _id : '$_id', _elements : { $push : '$$ROOT' } } }", // MQL could be optimized further |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MQL could be optimized further! :)
And now it is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
1ce73a1
to
24308cc
Compare
No description provided.