Skip to content

Query: Apply optimizations to composite predicates in all parts of the query #7608

Closed

Description

@maumar

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

Activity

  1. added this to the 2.0.0 milestone on Feb 14, 2017
  2. smitpatel commented on Feb 14, 2017

    @smitpatel
    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);
  3. 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[/+] on Feb 14, 2017
  4. modified the milestones: , 2.0.0 on Apr 19, 2017
  5. smitpatel commented on Apr 28, 2017

    @smitpatel
    Contributor

    Can I poach this?

  6. assigned and unassigned on Apr 28, 2017
  7. smitpatel commented on May 5, 2017

    @smitpatel
    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

  8. modified the milestones: , 2.0.0 on May 5, 2017
  9. 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[/+] on May 9, 2017
  10. 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[/+] on May 10, 2017
  11. modified the milestones: , 2.0.0 on Oct 15, 2022
  12. added theissue type on Jun 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions