You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
General issue for writing down, where we mark query source for materialization even though its not needed.
If GroupBy is not last result operator then even though we may not need to generate groupings, we still mark the query source inside the selector for materialization forcing us to do client groupby. See GroupBy_Distinct()
Presently during translation of GroupBy, we visit only element selector and discard SelectClause (since element selector defines what should go into group). But QSRM doesn't account for this due to lack of QMV backing it. Hence we visit selector & ElementSelector both but we can encountering GroupBy aggregate we cannot demote the selector because it not being QSRE (normal case when joining 2 querysources without explicit select. QSRM needs to consider this handling correctly. At present there is work-around for simple case here.
We should translate ConstantExpression in select clause to server if it is used in some aggregate or single value result. Since not translating it blocks the further translation. This could be useful in GroupBy scenario. It also has value without GroupBy case.
Promoting a QuerySource for materialization also update the inner query source but that happens only if the inner is subquery expression with QSRE in selector. If Selector is anonymous type of multiple QSRE then we don't update them.
Since we don't have QueryModelVisitor backing it, we always promote query sources in selector (regardless of QSRE or NewExpression). We may need to demote it based on which part of outer QM we are.
Additional issue with above 2 is, when selector is being used in outer but outer itself is not getting materialized, we end up with wrong materialization info of inner. We cannot mark demote inner selector always because outer may not properly mark underlying ones.
Some cases which are not properly identified surfaces in #11412
Activity
smitpatel commentedon Mar 10, 2018
Presently during translation of GroupBy, we visit only element selector and discard SelectClause (since element selector defines what should go into group). But QSRM doesn't account for this due to lack of QMV backing it. Hence we visit selector & ElementSelector both but we can encountering GroupBy aggregate we cannot demote the selector because it not being QSRE (normal case when joining 2 querysources without explicit select. QSRM needs to consider this handling correctly. At present there is work-around for simple case here.
We should translate ConstantExpression in select clause to server if it is used in some aggregate or single value result. Since not translating it blocks the further translation. This could be useful in GroupBy scenario. It also has value without GroupBy case.
smitpatel commentedon Mar 23, 2018
Some cases which are not properly identified surfaces in #11412
smitpatel commentedon May 24, 2018
As a fix for this we can possibly remove the need of whole visitor.
smitpatel commentedon Aug 15, 2019
No more RequiresMaterializationExpressionVisitor