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

Fix to #19023 - Query: Log query plan #19674

Merged
merged 1 commit into from
Feb 10, 2020
Merged

Fix to #19023 - Query: Log query plan #19674

merged 1 commit into from
Feb 10, 2020

Conversation

maumar
Copy link
Contributor

@maumar maumar commented Jan 23, 2020

Making RelationalCommandCache printable and printing it's SelectExpression.
Example query plan output:

queryContext => new QueryingEnumerable<int>(
    (RelationalQueryContext)queryContext,
    RelationalCommandCache.SelectExpression(
        (Projection Mapping:
            EmptyProjectionMember -> 0
        SELECT ((COUNT((*))))
        FROM (Customers AS c)
        WHERE ((c.CustomerID) == (N'ALFKI')))),
    null,
    ReaderColumn[] { ReaderColumn<int>, },
    Func<QueryContext, DbDataReader, ResultContext, int[], ResultCoordinator, int>,
    TestModels.Northwind.NorthwindRelationalContext,
    DiagnosticsLogger<Query>)
    .Single()

Fixes #19023

@@ -17,7 +17,7 @@ namespace Microsoft.EntityFrameworkCore.Query.Internal
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public class RelationalCommandCache
public class RelationalCommandCache : IPrintableExpression
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not great (at least the name). Alternative I can think of is adding back RelationalExpressionPrinter and some custom classes to print various types of objects wrapped inside ConstantExpression.

Adding interface to RelationalCommandCache seems like the lesser of 2 evils. Thoughts?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Internal class, so doesn't matter that much

@maumar maumar force-pushed the fix19023 branch 2 times, most recently from 3cfed1c to 61fcce8 Compare January 23, 2020 19:17
@maumar
Copy link
Contributor Author

maumar commented Feb 4, 2020

ping/thoughts?

Making RelationalCommandCache printable and printing it's SelectExpression.
Example query plan output:

queryContext => new QueryingEnumerable<int>(
    (RelationalQueryContext)queryContext,
    RelationalCommandCache.SelectExpression(
        (Projection Mapping:
            EmptyProjectionMember -> 0
        SELECT ((COUNT((*))))
        FROM (Customers AS c)
        WHERE ((c.CustomerID) == (N'ALFKI')))),
    null,
    ReaderColumn[] { ReaderColumn<int>, },
    Func<QueryContext, DbDataReader, ResultContext, int[], ResultCoordinator, int>,
    TestModels.Northwind.NorthwindRelationalContext,
    DiagnosticsLogger<Query>)
    .Single()

Fixes #19023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Query: Log query plan
2 participants