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: Prune SelectExpression to remove not needed TPT LeftJoin tables #21992

Merged
1 commit merged into from
Aug 11, 2020

Conversation

smitpatel
Copy link
Member

Resolves #21773

  • For top level SelectExpression in client code, we preserve whole projection.

  • We search for all the referenced column for each table in SelectExpression

    • If there are no references outside and if it is LeftJoinExpression for TPT (which is remembered through a state in SelectExpression), then we remove the table altogether.
    • If the table is nested SelectExpression (direct or through a join) then we take referenced columns for that table and prune projection of inner SelectExpression and apply process recursively to prune TPT pattern inside subquery.
  • Removes derived tables when projecting out only base properties of TPT

  • Removes derived tables when joining with collection on base and not selecting any of the derived properties of TPT

@smitpatel smitpatel requested review from a team and maumar August 8, 2020 02:10
Resolves #21773

- For top level SelectExpression in client code, we preserve whole projection.
- We search for all the referenced column for each table in SelectExpression
  - If there are no references outside and if it is LeftJoinExpression for TPT (which is remembered through a state in SelectExpression), then we remove the table altogether.
  - If the table is nested SelectExpression (direct or through a join) then we take referenced columns for that table and prune projection of inner SelectExpression and apply process recursively to prune TPT pattern inside subquery.

- Removes derived tables when projecting out only base properties of TPT
- Removes derived tables when joining with collection on base and not selecting any of the derived properties of TPT
@smitpatel
Copy link
Member Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ghost
Copy link

ghost commented Aug 11, 2020

Hello @smitpatel!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TPT: Avoid connecting with derived tables when not selecting any properties from them
3 participants