Skip to content
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

Query: QuerySourceTracingExpressionVisitor doesn't always prune EF.Property expressions #8053

Closed
maumar opened this issue Apr 1, 2017 · 3 comments
Assignees
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Milestone

Comments

@maumar
Copy link
Contributor

maumar commented Apr 1, 2017

Currently, when pruning EF.Property calls in the QuerySourceTracingExpressionVisitor we have additional check, which is not needed - we should always prune EF.Property calls (just like we always prune MemberExpressions)

@maumar maumar self-assigned this Apr 1, 2017
@maumar
Copy link
Contributor Author

maumar commented Apr 1, 2017

Found when investigating #5612

@maumar
Copy link
Contributor Author

maumar commented Apr 3, 2017

repro:

ctx.Gears
	.OrderBy(g => g.Rank)
	.Include(g => g.Tag)
	.Where(g => g.HasSoulPatch)
	.Select(g => new { FullName = EF.Property<string>(g, "FullName") });

Include should be ignored, but we try to apply it here, which results in unnecessarily complex query:

SELECT [g.Tag].[Id], [g.Tag].[GearNickName], [g.Tag].[GearSquadId], [g.Tag].[Note]
FROM [CogTag] AS [g.Tag]

SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOrBirthName], [g0].[Discriminator], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank]
FROM [Gear] AS [g0]
WHERE [g0].[Discriminator] IN (N'Officer', N'Gear')
ORDER BY [g0].[Rank]

what we should be generating is:

SELECT [g0].[HasSoulPatch], [g0].[FullName]
FROM [Gear] AS [g0]
WHERE [g0].[Discriminator] IN (N'Officer', N'Gear')
ORDER BY [g0].[Rank]

maumar added a commit that referenced this issue Apr 3, 2017
…ays prune EF.Property expressions

Problem was that we were adding unnecessary condition when pruning EF.Property from the QuerySourceTracingExpressionVisitor.

Fix is to remove the check so that all the EF.Property calls will correctly be pruned.
@maumar
Copy link
Contributor Author

maumar commented Apr 3, 2017

Fixed in 8053

@maumar maumar closed this as completed Apr 3, 2017
@maumar maumar added this to the 2.0.0 milestone Apr 3, 2017
@maumar maumar added closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug labels Apr 3, 2017
@divega divega added closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. and removed closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. labels May 10, 2017
@ajcvickers ajcvickers modified the milestones: 2.0.0-preview1, 2.0.0 Oct 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Projects
None yet
Development

No branches or pull requests

3 participants