-
Notifications
You must be signed in to change notification settings - Fork 930
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
WIP - Support non parameterized constants query plan caching for Linq provider #2375
base: master
Are you sure you want to change the base?
Conversation
cb0b7ce
to
a86ccb3
Compare
|
||
// TODO 6.0: Move to IResultTransformer | ||
internal interface IResultTransformerExtended : IResultTransformer |
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.
This IResultTransformer
interface is quite an ugly thing and this extension doesn't make it any better... Can you think of any way to avoid this interface changes? Why do we need to have parameterValues
as parameters? Why can't it be internal state of LINQ ResultTransfomer
class? IMHO it's better to recreate it on each query execution if it avoids interface changes (if for instance it's now part of query cache). Is it really needed in any other place?
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.
Can you think of any way to avoid this interface changes?
Maybe by creating a new instance of ResultTransformer
each time a query is executed and pass parameterValues
in the constructor instead. I will try if it is possible.
a86ccb3
to
2c9cc58
Compare
07de27f
to
ac6d753
Compare
Force pushed a version that does not need to alter the |
With this PR query plans for queries like:
will be cached. This was achieved by adding an additional parameter for item/list/post transformers, which contains all parameter values.
For the following query:
the selector will be cached as:
(input, parameterValues) => new {CustomerId = input[0], Constant = parameterValues[0]}
before this PR it was cached as:
(input) => new {CustomerId = input[0], Constant = "constant"}
.In order to handle scenarios where a parameter detected by
ExpressionParameterVisitor
is converted to a hql constant, a special logic was added (VisitorParameters.UpdateCanCachePlan
) that check whether all parameters in the expression were converted to hql. One example isTrimGenerator
, wherechar
parameter is converted to string and it is used to create a hql constant. In that case the query plan won't be cached.Added WIP as it is a continuation of #2365.
Possible breaking changes:
AdditionalCriteria
inExpressionToHqlTranslationResults
is not populated anymore,PreQueryExecuteDelegates
property has to be used insteadDelegateExpressionToHqlTranslationResults.PostExecuteTransformer
gained one parameter of typeobject[]
ToFutureValue
andToFuture
methods are no longer wrapped insideTargetInvocationException
.