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

Don't ask how! 😢 #21707

Merged
1 commit merged into from
Jul 21, 2020
Merged

Don't ask how! 😢 #21707

1 commit merged into from
Jul 21, 2020

Conversation

smitpatel
Copy link
Member

Resolves #21700

@ghost
Copy link

ghost commented Jul 21, 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.

@smitpatel
Copy link
Member Author

@msftbot require 1 approval

@ghost
Copy link

ghost commented Jul 21, 2020

Hello @smitpatel!

Because you've given me some instructions on how to help merge this pull request, I'll be modifying my merge approach. Here's how I understand your requirements for merging this pull request:

  • I'll only merge this pull request if it has at least 1 approval

If this doesn't seem right to you, you can tell me to cancel these instructions and use the auto-merge policy that has been configured for this repository. Try telling me "forget everything I just told you".

@AndriySvyryd
Copy link
Member

Wouldn't this allow a hash collision?

@smitpatel
Copy link
Member Author

Wouldn't this allow a hash collision?

Yes, it will.

  • This code was added in Query: Don't read default value from databases #21668 so queries did work without it just fine previously. So there is at least no customer issue.
  • Projections are comprised of ColumnExpressions or combination of them. SelectExpression.Tables will visit those to add hash code in case those differs.
  • Just anecdotal very rarely we have 2 select expressions which only differs in client or expanded projection but in no other component.

The way I see it is hash collision in rare case vs slow compilation in all cases. Also a hash collision will go through equals so that no 2 different entities are matched. Equals part is still in place to avoid any issue in collision case.

@smitpatel
Copy link
Member Author

I also tried out another approach though it ran into issue so definitely not a cheap fix. I wrote detailed comment about that in #18923 (comment)
Hopefully we can improve this in future release. (also reason for adding TODO)

@ghost ghost merged commit a92f89c into master Jul 21, 2020
@ghost ghost deleted the smit/harsh branch July 21, 2020 02:32
@roji
Copy link
Member

roji commented Jul 21, 2020

Looks very related to #19859 - I'm really not sure why we're recursing through the entire tree when calculating hash codes (as opposed to equality comparisons)... Hash collisions are completely normal, and as long as we achieve reasonable spread of keys everything should be fine (and fast)...

A great example is ColumnExpression, where we recurse into the Table (which can be an arbitrarily deep subquery). I think it should be perfectly fine to only include the column name.

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.

Perf regression in query compilation
3 participants