Repository navigation
Conversation
|
@tuespetre, |
83691fa to
36b34a2
Compare
| { | ||
| Check.NotNull(visitor, nameof(visitor)); | ||
|
|
||
| var specificVisitor = visitor as ISqlExpressionVisitor; |
There was a problem hiding this comment.
Ugh, C#7 came out since I first wrote this
36b34a2 to
dffff3a
Compare
1af6773 to
b9132a8
Compare
b9132a8 to
011de73
Compare
| var innerSelectExpression = TryGetQuery(fromClause); | ||
|
|
||
| if (innerSelectExpression?.Tables.Count != 1) | ||
| if (outerSelectExpression == null || innerSelectExpression == null) |
There was a problem hiding this comment.
Any specific reason to remove check on tables count?
|
|
||
| if (finalResultOperator is DefaultIfEmptyResultOperator) | ||
| { | ||
| innerSelectExpression = (SelectExpression)innerSelectExpression.Tables[0]; |
There was a problem hiding this comment.
value being used in all the paths, store in variable before entering the if blocks.
There was a problem hiding this comment.
also use different variable name here. Causes bit of confusion with the table count check above, that how did we end up with 2nd table in innerSelectExpression.
| } | ||
| else | ||
| { | ||
| outerSelectExpression.AddCrossJoinLateral( |
There was a problem hiding this comment.
add test for this - similar to SelectMany_Joined_DefaultIfEmpty but with .Distinct() or other result op after DIE (also maybe Distinct and then DIE?)
These changes simply pull up the pushed down subquery expression created by the
RelationalResultOperatorHandlerfor theDefaultIfEmptyResultOperatorand add it as aLeftJoinLateralExpressioninstead of aCrossJoinLateralExpression.Another possible optimization that could be handled later is to re-order subquery result operators to 'float'
DefaultIfEmptyResultOperators to the end of the list, e.g. for cases like.DefaultIfEmpty().Distinct()or.DefaultIfEmpty().Take(x).Skip(y). That would allow more queries to becomeOUTER APPLYinstead ofCROSS APPLY.