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: Apply optimizations to composite predicates in all parts of the query #7608

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

Comments

@maumar
Copy link
Contributor

maumar commented Feb 14, 2017

Currently CompositePredicateExpressionVisitor is only applied to predicates. Perhaps some of the work we do there could be applied in other places (e.g projections)

@smitpatel
Copy link
Contributor

See Tests
Optional_navigation_type_compensation_works_with_contains
Any_with_optional_navigation_as_subquery_predicate_is_translated_to_sql
All_with_optional_navigation_is_translated_to_sql
Optional_navigation_type_compensation_works_with_all

Assert.Equal(
                @"SELECT CASE
    WHEN NOT EXISTS (
        SELECT 1
        FROM [CogTag] AS [t]
        LEFT JOIN (
            SELECT [t.Gear].[Nickname], [t.Gear].[SquadId], [t.Gear].[AssignedCityName], [t.Gear].[CityOrBirthName], [t.Gear].[Discriminator], [t.Gear].[FullName], [t.Gear].[HasSoulPatch], [t.Gear].[LeaderNickname], [t.Gear].[LeaderSquadId], [t.Gear].[Rank]
            FROM [Gear] AS [t.Gear]
            WHERE ([t.Gear].[Discriminator] = N'Officer') OR ([t.Gear].[Discriminator] = N'Gear') //<--- BAD LINE
        ) AS [t0] ON ([t].[GearNickName] = [t0].[Nickname]) AND ([t].[GearSquadId] = [t0].[SquadId])
        WHERE (([t].[Note] <> N'K.I.A.') OR [t].[Note] IS NULL) AND ([t0].[HasSoulPatch] = 0))
    THEN CAST(1 AS BIT) ELSE CAST(0 AS BIT)
END",
                Sql);

@smitpatel smitpatel changed the title Query/Cleanup : see if we can use optimizations from CompositePredicateExpressionVisitor in other parts of the query Query/Cleanup : Apply optimizations from CompositePredicateExpressionVisitor in other parts of the query Feb 14, 2017
@ajcvickers ajcvickers modified the milestones: 2.0.0-preview1, 2.0.0 Apr 19, 2017
@smitpatel
Copy link
Contributor

Can I poach this?

@maumar maumar assigned smitpatel and unassigned maumar Apr 28, 2017
@smitpatel
Copy link
Contributor

This is already fixed in latest dev. The issue in above query was, we had to go inside of ExistExpression. It was missing proper VisitChildren method. Which was done in #7646 Thanks @tuespetre

@smitpatel smitpatel modified the milestones: 2.0.0-preview1, 2.0.0 May 5, 2017
@smitpatel smitpatel added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label May 5, 2017
@ajcvickers ajcvickers changed the title Query/Cleanup : Apply optimizations from CompositePredicateExpressionVisitor in other parts of the query Query: Apply optimizations from CompositePredicateExpressionVisitor in other parts of the query May 9, 2017
@divega divega changed the title Query: Apply optimizations from CompositePredicateExpressionVisitor in other parts of the query Query: Apply optimizations to composite predicates in all parts of the query 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-enhancement
Projects
None yet
Development

No branches or pull requests

5 participants