Efcore: QueryRewrite: convert all enumerable query methods to queryable early during query processing

Created on 4 Jun 2019  路  11Comments  路  Source: dotnet/efcore

Linq query can have enumerable methods, e.g. when composing on top of collection navigation, or grouping in result selector of a GroupJoin.

We can convert all of them to Queryable early on, so that individual visitors only need to do pattern matching on a subset. Where needed we can inject AsQueryable so that types match.

area-query closed-fixed type-enhancement

All 11 comments

Should we also get rid of all those pesky Quote expressions while we're at it?

Can you really get rid of them? o.O

You mean the expression tree API verifies that there's always QuoteExpression around LamdaExpressions that return IQueryable? If so maybe we can convert everything to IEnumerable instead of the other way around :smiling_imp: ?

I don't know if it verifies. We cannot go the other way for sure since there are our own methods defined on IQueryable

it doesn't verify, nav expansion already swallows quotes and nothing bad happens :3

image

I wish I can imagine that but translation needs to deal with quote nodes still.

Note from triage: @maumar @roji If you want to pursue this, then please prepare something for the design meeting.

@ajcvickers we can discuss although this is ultimately an internal query pipeline implementation design question, i.e. is it possible to normalize some aspects early to make things easier in actual visitors... I guess we should check if it's even possible first.

@roji In general I think bringing the question to the wider team is useful when there is some question as to the best design on internal query pipeline things. This is perhaps something we haven't been so good at in the past.

Queryable conversion was done in https://github.com/dotnet/efcore/pull/15721 already, which has improved over the time. We are not remove quotes.

Was this page helpful?
0 / 5 - 0 ratings