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: compilation error (dangling qsre) for query with SelectMany, order by and include collection #12794

Closed
maumar opened this issue Jul 25, 2018 · 2 comments · Fixed by #17766
Assignees
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. punted-for-3.0 type-bug
Milestone

Comments

@maumar
Copy link
Contributor

maumar commented Jul 25, 2018

Query:

var query = ctx.LevelOne.OrderBy(l1 => l1.Id).SelectMany(l1 => l1.OneToMany_Optional).Include(l2 => l2.OneToMany_Optional);
var result = query.ToList();

query plan:

(QueryContext queryContext) => IEnumerable<Level2> _InterceptExceptions(
|__ source: IEnumerable<Level2> _Select(
|   |__ source: IEnumerable<TransparentIdentifier<ValueBuffer, Level2>> _Join(
|   |   |__ outer: IOrderedEnumerable<ValueBuffer> _ThenBy(
|   |   |   |__ source: IOrderedEnumerable<ValueBuffer> _OrderBy(
|   |   |   |   |__ source: IEnumerable<ValueBuffer> _ShapedQuery(
|   |   |   |   |   |__ queryContext: queryContext, 
|   |   |   |   |   |__ shaperCommandContext: SelectExpression: 
|   |   |   |   |   |       SELECT [l1].[Id]
|   |   |   |   |   |       FROM [LevelOne] AS [l1], 
|   |   |   |   |   |__ shaper: ValueBufferShaper), 
|   |   |   |   |__ expression: (ValueBuffer l1) => int TryReadValue(l1, 0, Level1.Id), 
|   |   |   |   |__ orderingDirection: Asc), 
|   |   |   |__ expression: (ValueBuffer l1) => 
|   |   |   |   {
|   |   |   |       __caller =  ---> [l1.OneToMany_Optional] <--- 
|   |   |   |       __result = default(Nullable<int>)
|   |   |   |       __caller != default(Level2) ? __result = Nullable<int> GetValue(
|   |   |   |       |__ queryContext: queryContext, 
|   |   |   |       |__ entity: __caller, 
|   |   |   |       |__ property: Level2.Id) : default(void)
|   |   |   |       return __result
|   |   |   |   }, 
|   |   |   |__ orderingDirection: Asc), 
|   |   |__ inner: IEnumerable<Level2> _ShapedQuery(
|   |   |   |__ queryContext: queryContext, 
|   |   |   |__ shaperCommandContext: SelectExpression: 
|   |   |   |       SELECT [l1.OneToMany_Optional].[Id], [l1.OneToMany_Optional].[Date], [l1.OneToMany_Optional].[Level1_Optional_Id], [l1.OneToMany_Optional].[Level1_Required_Id], [l1.OneToMany_Optional].[Name], [l1.OneToMany_Optional].[OneToMany_Optional_InverseId], [l1.OneToMany_Optional].[OneToMany_Optional_Self_InverseId], [l1.OneToMany_Optional].[OneToMany_Required_InverseId], [l1.OneToMany_Optional].[OneToMany_Required_Self_InverseId], [l1.OneToMany_Optional].[OneToOne_Optional_PK_InverseId], [l1.OneToMany_Optional].[OneToOne_Optional_SelfId]
|   |   |   |       FROM [LevelTwo] AS [l1.OneToMany_Optional], 
|   |   |   |__ shaper: BufferedEntityShaper<Level2>), 
|   |   |__ outerKeySelector: (ValueBuffer l1) => (Nullable<int>)int TryReadValue(l1, 0, Level1.Id), 
|   |   |__ innerKeySelector: (Level2 l1.OneToMany_Optional) => Nullable<int> GetValue(
|   |   |   |__ queryContext: queryContext, 
|   |   |   |__ entity: l1.OneToMany_Optional, 
|   |   |   |__ property: Level2.OneToMany_Optional_InverseId), 
|   |   |__ resultSelector: (ValueBuffer l1 | Level2 l1.OneToMany_Optional) => TransparentIdentifier<ValueBuffer, Level2> CreateTransparentIdentifier(
|   |       |__ outer: l1, 
|   |       |__ inner: l1.OneToMany_Optional)), 
|   |__ selector: (TransparentIdentifier<ValueBuffer, Level2> t0) => Level2 _Include(
|       |__ queryContext: queryContext, 
|       |__ entity: t0.Inner, 
|       |__ included: new object[]{ }, 
|       |__ fixup: (QueryContext queryContext | Level2 entity | object[] included) => 
|           {
|               return void queryContext.QueryBuffer.IncludeCollection(
|               |__ includeId: 0, 
|               |__ navigation: Level2.OneToMany_Optional, 
|               |__ inverseNavigation: Level3.OneToMany_Optional_Inverse, 
|               |__ targetEntityType: EntityType: Level3, 
|               |__ clrCollectionAccessor: ClrICollectionAccessor<Level2, ICollection<Level3>, Level3>, 
|               |__ inverseClrPropertySetter: ClrPropertySetter<Level3, Level2>, 
|               |__ tracking: False, 
|               |__ instance: entity, 
|               |__ valuesFactory: () => IEnumerable<Level3> _ShapedQuery(
|               |   |__ queryContext: queryContext, 
|               |   |__ shaperCommandContext: SelectExpression: 
|               |   |       SELECT [l1.OneToMany_Optional.OneToMany_Optional].[Id], [l1.OneToMany_Optional.OneToMany_Optional].[Level2_Optional_Id], [l1.OneToMany_Optional.OneToMany_Optional].[Level2_Required_Id], [l1.OneToMany_Optional.OneToMany_Optional].[Name], [l1.OneToMany_Optional.OneToMany_Optional].[OneToMany_Optional_InverseId], [l1.OneToMany_Optional.OneToMany_Optional].[OneToMany_Optional_Self_InverseId], [l1.OneToMany_Optional.OneToMany_Optional].[OneToMany_Required_InverseId], [l1.OneToMany_Optional.OneToMany_Optional].[OneToMany_Required_Self_InverseId], [l1.OneToMany_Optional.OneToMany_Optional].[OneToOne_Optional_PK_InverseId], [l1.OneToMany_Optional.OneToMany_Optional].[OneToOne_Optional_SelfId]
|               |   |       FROM [LevelThree] AS [l1.OneToMany_Optional.OneToMany_Optional]
|               |   |       INNER JOIN (
|               |   |           SELECT DISTINCT [l1.OneToMany_Optional0].[Id], [l10].[Id] AS [Id0]
|               |   |           FROM [LevelOne] AS [l10]
|               |   |           INNER JOIN [LevelTwo] AS [l1.OneToMany_Optional0] ON [l10].[Id] = [l1.OneToMany_Optional0].[OneToMany_Optional_InverseId]
|               |   |       ) AS [t] ON [l1.OneToMany_Optional.OneToMany_Optional].[OneToMany_Optional_InverseId] = [t].[Id]
|               |   |       ORDER BY [t].[Id0], [t].[Id], 
|               |   |__ shaper: BufferedEntityShaper<Level3>), 
|               |__ joinPredicate: default(Func<Level2, Level3, bool>))
|           })), 
|__ contextType: TestModels.ComplexNavigationsModel.ComplexNavigationsContext, 
|__ logger: DiagnosticsLogger<Query>, 
|__ queryContext: Unhandled parameter: queryContext)
@ajcvickers
Copy link
Member

Added to #12795

@smitpatel
Copy link
Member

Dependent on #12737

@smitpatel smitpatel added the verify-fixed This issue is likely fixed in new query pipeline. label Jun 5, 2019
@smitpatel smitpatel removed their assignment Jun 5, 2019
@ajcvickers ajcvickers modified the milestones: 3.0.0, Backlog Jun 28, 2019
@ajcvickers ajcvickers modified the milestones: Backlog, 3.1.0 Sep 4, 2019
@smitpatel smitpatel 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 10, 2019
@smitpatel smitpatel modified the milestones: 3.1.0, 3.0.0 Sep 10, 2019
smitpatel added a commit that referenced this issue Sep 11, 2019
Covers EFCore.Specs.Tests Query folder

Resolves #8366
Resolves #8582
Resolves #8722
Resolves #9007
Resolves #9254
Resolves #12574
Resolves #12579
Resolves #12598
Resolves #12786
Resolves #12787
Resolves #12794
Resolves #12806
Resolves #12827
Resolves #12873
Resolves #14900
Resolves #15862
Resolves #16157
Resolves #17240
Resolves #17243


Close #12889
Close #17243
smitpatel added a commit that referenced this issue Sep 11, 2019
Covers EFCore.Specs.Tests Query folder

Resolves #8366
Resolves #8582
Resolves #8722
Resolves #9007
Resolves #9254
Resolves #12574
Resolves #12579
Resolves #12598
Resolves #12786
Resolves #12787
Resolves #12794
Resolves #12806
Resolves #12827
Resolves #12873
Resolves #14900
Resolves #15862
Resolves #16157
Resolves #17240


Close #12889
Close #17243
smitpatel added a commit that referenced this issue Sep 11, 2019
Covers EFCore.Specs.Tests Query folder

Resolves #8366
Resolves #8582
Resolves #8722
Resolves #9007
Resolves #9254
Resolves #12574
Resolves #12579
Resolves #12598
Resolves #12786
Resolves #12787
Resolves #12794
Resolves #12806
Resolves #12827
Resolves #12873
Resolves #14900
Resolves #15862
Resolves #16157
Resolves #17240


Close #12889
Close #17243
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-3.0 type-bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants