-
Notifications
You must be signed in to change notification settings - Fork 455
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
UseBinaryAggregateExpression rework #812
Conversation
disable broken test for sql2014
@detoxhby I hope it will solve your issue |
Found another issue with this functionality - query cache comparison uses initial expression and still fails |
|
Have to correct myself, I forgot that I've removed the
|
I have good news. |
@detoxhby could you test it once more? |
@MaceWindu just did it, something broke. Random errors from not inserting data to even missing FKs :/ (just read your update) |
@detoxhby now it should work |
@MaceWindu seems good! ✅ Even though the commit diff looks terrifying ... was it really "just" that? How was it working for other providers (like SqlServer) and struggle only on SQLCe if there is no provider-specific changes here? |
Well, it wasn't SqlCe specific issue. For queries with parameters we generate methods to extract parameter value from expression. They were generated to work with initial expression, but when this optimization applied - expression structure changes and parameter extractor receives expression with different structure and that is why you get all those invalid cast expressions: when method expected element of one type - he received completely different one. Why it was broken only for SqlCe in your case - I cannot say for sure. It suspect one of those:
With this fix, expression will be optimized before it used by linq2db for anything else. Update: also issue with incorrect query caching, fixed with this PR, also was affecting chances to get this error. |
@MaceWindu thanks for the explanation and fix, keep up the good work! |
@@ -334,7 +331,30 @@ Expression AggregateExpression(Expression expression) | |||
|
|||
if (items.Count > 2) |
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.
I think we can use here Count > 3
No description provided.