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: we don't know how to lift join on QSRE projecting a single column #10172

Closed
maumar opened this issue Oct 26, 2017 · 1 comment · Fixed by #17805
Closed

Query: we don't know how to lift join on QSRE projecting a single column #10172

maumar opened this issue Oct 26, 2017 · 1 comment · Fixed by #17805
Assignees
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. punted-for-2.1 type-bug
Milestone

Comments

@maumar
Copy link
Contributor

maumar commented Oct 26, 2017

from g in ctx.Gears
join inner in (
	from g2 in ctx.Gears
	select g2.Nickname
	) on g.Nickname equals inner
select g;

produces the following query plan:

(QueryContext queryContext) => IEnumerable<Gear> _InterceptExceptions(
    source: IEnumerable<Gear> _Select(
        source: IEnumerable<TransparentIdentifier<Gear, string>> _Join(
            outer: IEnumerable<Gear> _ShapedQuery(
                queryContext: queryContext, 
                shaperCommandContext: SelectExpression: 
                    SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOrBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank]
                    FROM [Gears] AS [g]
                    WHERE [g].[Discriminator] IN (N'Officer', N'Gear'), 
                shaper: BufferedEntityShaper<Gear>), 
            inner: IEnumerable<string> _ShapedQuery(
                queryContext: queryContext, 
                shaperCommandContext: SelectExpression: 
                    SELECT [t].[Nickname]
                    FROM (
                        SELECT [g2].[Nickname]
                        FROM [Gears] AS [g2]
                        WHERE [g2].[Discriminator] IN (N'Officer', N'Gear')
                    ) AS [t], 
                shaper: (TypedProjectionShaper<ValueBufferShaper, ValueBuffer, string>
                materializer: (ValueBuffer g2) => string TryReadValue(g2, 0, Gear.Nickname))), 
            outerKeySelector: (Gear g) => g.Nickname, 
            innerKeySelector: (string inner) => inner, 
            resultSelector: (Gear g | string inner) => TransparentIdentifier<Gear, string> CreateTransparentIdentifier(
                outer: g, 
                inner: inner)), 
        selector: (TransparentIdentifier<Gear, string> t0) => t0.Outer), 
    contextType: TestModels.GearsOfWarModel.GearsOfWarContext, 
    logger: DiagnosticsLogger<Query>, 
    queryContext: queryContext)

However we are perfectly capable of translating very similar query, that projects single property wrapped in anonymous type:

from g in ctx.Gears
join inner in (
     from g2 in ctx.Gears
     select new { g2.Nickname }
     ) on g.Nickname equals inner.Nickname
select g;

produces:

(QueryContext queryContext) => IEnumerable<Gear> _InterceptExceptions(
    source: IEnumerable<Gear> _ShapedQuery(
        queryContext: queryContext, 
        shaperCommandContext: SelectExpression: 
            SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOrBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], [t].[Nickname]
            FROM [Gears] AS [g]
            INNER JOIN (
                SELECT [g2].[Nickname]
                FROM [Gears] AS [g2]
                WHERE [g2].[Discriminator] IN (N'Officer', N'Gear')
            ) AS [t] ON [g].[Nickname] = [t].[Nickname]
            WHERE [g].[Discriminator] IN (N'Officer', N'Gear'), 
        shaper: (BufferedOffsetEntityShaper<Gear>
        materializer: (TransparentIdentifier<Gear, <>f__AnonymousType227<string>> t0) => t0.Outer)), 
    contextType: TestModels.GearsOfWarModel.GearsOfWarContext, 
    logger: DiagnosticsLogger<Query>, 
    queryContext: queryContext)
@maumar maumar changed the title Query: we don't know how to lift join on qsre projecting a column Query: we don't know how to lift join on qsre projecting a single column Oct 26, 2017
@ajcvickers ajcvickers added this to the 2.1.0 milestone Oct 30, 2017
@ajcvickers ajcvickers modified the milestones: 2.1.0-preview1, 2.1.0 Jan 17, 2018
@maumar maumar removed this from the 2.1.0 milestone Feb 14, 2018
@ajcvickers ajcvickers changed the title Query: we don't know how to lift join on qsre projecting a single column Query: we don't know how to lift join on QSRE projecting a single column Feb 16, 2018
@ajcvickers ajcvickers added this to the Backlog milestone Feb 16, 2018
@AndriySvyryd AndriySvyryd added the verify-fixed This issue is likely fixed in new query pipeline. label Aug 22, 2019
@ajcvickers ajcvickers modified the milestones: Backlog, 3.1.0 Sep 4, 2019
@maumar
Copy link
Contributor Author

maumar commented Sep 11, 2019

verified this issue has been fixed in 3.0

@maumar maumar modified the milestones: 3.1.0, 3.0.0 Sep 11, 2019
@maumar maumar added closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. and removed verify-fixed This issue is likely fixed in new query pipeline. labels Sep 11, 2019
maumar added a commit that referenced this issue Sep 12, 2019
Resolves #8723
Resolves #9241
Resolves #10172
Resolves #10210
Resolves #10548
Resolves #11847
Resolves #11933
Resolves #12741
Resolves #15798
@maumar maumar closed this as completed in 36a7bdf Sep 12, 2019
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. punted-for-2.1 type-bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants