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

sql: bugfix to interleaved join planning criteria #26756

Merged
merged 1 commit into from
Jun 18, 2018

Conversation

jordanlewis
Copy link
Member

@jordanlewis jordanlewis commented Jun 15, 2018

Previously, interleaved joins could take place if the tables were
ancestors of each other, there was a merge join ordering on the equality
columns, and the left equality columns were a prefix of the interleaved
columns. These criteria are insufficient: the right equality columns
must also be a prefix of the interleaved columns. A case where this
wouldn't naturally hold is where the right equality columns get a merge
join ordering because they're known to be constant.

Release note (bug fix): joins across two interleaved tables no longer
return incorrect results under certain circumstances when the equality
columns aren't all part of the interleaved columns.

Fixes #25838. I verified that the new test fails before the fix was applied.

@jordanlewis jordanlewis requested review from RaduBerinde and a team June 15, 2018 20:55
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@RaduBerinde
Copy link
Member

Can you add the simplified case you came up with as a logictest?

@jordanlewis
Copy link
Member Author

Yeah, good point. Done.

Previously, interleaved joins could take place if the tables were
ancestors of each other, there was a merge join ordering on the equality
columns, and the left equality columns were a prefix of the interleaved
columns. These criteria are insufficient: the right equality columns
must also be a prefix of the interleaved columns. A case where this
wouldn't naturally hold is where the right equality columns get a merge
join ordering because they're known to be constant.

Release note (bug fix): joins across two interleaved tables no longer
return incorrect results under certain circumstances when the equality
columns aren't all part of the interleaved columns.
@RaduBerinde
Copy link
Member

:lgtm:


Review status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale)


Comments from Reviewable

@jordanlewis
Copy link
Member Author

bors r+

craig bot pushed a commit that referenced this pull request Jun 18, 2018
26756: sql: bugfix to interleaved join planning criteria r=jordanlewis a=jordanlewis

Previously, interleaved joins could take place if the tables were
ancestors of each other, there was a merge join ordering on the equality
columns, and the left equality columns were a prefix of the interleaved
columns. These criteria are insufficient: the right equality columns
must also be a prefix of the interleaved columns. A case where this
wouldn't naturally hold is where the right equality columns get a merge
join ordering because they're known to be constant.

Release note (bug fix): joins across two interleaved tables no longer
return incorrect results under certain circumstances when the equality
columns aren't all part of the interleaved columns.

Fixes #25838. I verified that the new test fails before the fix was applied.

Co-authored-by: Jordan Lewis <jordanthelewis@gmail.com>
@craig
Copy link
Contributor

craig bot commented Jun 18, 2018

Build succeeded

@craig craig bot merged commit 91a325e into cockroachdb:master Jun 18, 2018
craig bot pushed a commit that referenced this pull request Jun 19, 2018
26832: backport-2.0: sql: bugfix to interleaved join planning criteria r=jordanlewis a=jordanlewis

Backport 1/1 commits from #26756.

/cc @cockroachdb/release

---

Previously, interleaved joins could take place if the tables were
ancestors of each other, there was a merge join ordering on the equality
columns, and the left equality columns were a prefix of the interleaved
columns. These criteria are insufficient: the right equality columns
must also be a prefix of the interleaved columns. A case where this
wouldn't naturally hold is where the right equality columns get a merge
join ordering because they're known to be constant.

Release note (bug fix): joins across two interleaved tables no longer
return incorrect results under certain circumstances when the equality
columns aren't all part of the interleaved columns.

Fixes #25838. I verified that the new test fails before the fix was applied.


Co-authored-by: Jordan Lewis <jordanthelewis@gmail.com>
@jordanlewis jordanlewis deleted the fix-uuid branch June 19, 2018 21:56
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.

sql: Joining Interleaved table with parent table over UUID typed column fails.
3 participants