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

exec: fix output batches of LEFT SEMI for hash and merge joiners #39294

Merged
merged 1 commit into from
Aug 15, 2019

Conversation

yuzefovich
Copy link
Member

Previously, the merge joiner's output batch would always have the
columns corresponding to both the left and the right sides (even
with LEFT SEMI and LEFT ANTI join types although the right side
output would not be used). This is incorrect, and now the merge
joiner outputs batches with the correct number of columns.

A similar issue was present with LEFT SEMI hash joiner and is now
fixed.

Release note: None

@yuzefovich yuzefovich requested review from jordanlewis, rafiss and a team August 3, 2019 15:57
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@yuzefovich
Copy link
Member Author

The issue presented itself in the distributed case during serialization:
pq: internal error: mismatched batch width and schema length: 4 != 2.

@yuzefovich yuzefovich added the do-not-merge bors won't merge a PR with this label. label Aug 3, 2019
@yuzefovich
Copy link
Member Author

I added DNM label until #39299 is fixed (the current reproduction relies on this bug being present).

@asubiotto asubiotto removed the do-not-merge bors won't merge a PR with this label. label Aug 6, 2019
@asubiotto
Copy link
Contributor

I understand the cause and fixed in #39331 so removed the DNM label.

@yuzefovich
Copy link
Member Author

It is now RFAL.

@yuzefovich
Copy link
Member Author

Friendly ping.

Copy link
Contributor

@asubiotto asubiotto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 4 of 4 files at r1.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @jordanlewis, @rafiss, and @yuzefovich)


pkg/sql/exec/hashjoiner.go, line 52 at r1 (raw file):

type hashJoinerSpec struct {
	// TODO(yuzefovich): update this when LEFT ANTI is supported.
	isLeftSemi bool

Would it make sense to just have this be a sqlbase.JoinType? I'm fine with this too


pkg/sql/exec/mergejoiner.go, line 310 at r1 (raw file):

	right mergeJoinInput

	isLeftSemiAnti bool

Same here.

@yuzefovich yuzefovich force-pushed the fix-left-mj branch 2 times, most recently from f530354 to 3f7b8eb Compare August 15, 2019 12:47
Previously, the merge joiner's output batch would always have the
columns corresponding to both the left and the right sides (even
with LEFT SEMI and LEFT ANTI join types although the right side
output would not be used). This is incorrect, and now the merge
joiner outputs batches with the correct number of columns.

A similar issue was present with LEFT SEMI hash joiner and is now
fixed.

Release note: None
Copy link
Member Author

@yuzefovich yuzefovich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TFTR!

bors r+

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @asubiotto, @jordanlewis, and @rafiss)


pkg/sql/exec/hashjoiner.go, line 52 at r1 (raw file):

Previously, asubiotto (Alfonso Subiotto Marqués) wrote…

Would it make sense to just have this be a sqlbase.JoinType? I'm fine with this too

I didn't want to introduce the join type into the "base" joiner. I refactored the code, so I think your concern has been resolved.


pkg/sql/exec/mergejoiner.go, line 310 at r1 (raw file):

Previously, asubiotto (Alfonso Subiotto Marqués) wrote…

Same here.

Done.

craig bot pushed a commit that referenced this pull request Aug 15, 2019
39294: exec: fix output batches of LEFT SEMI for hash and merge joiners r=yuzefovich a=yuzefovich

Previously, the merge joiner's output batch would always have the
columns corresponding to both the left and the right sides (even
with LEFT SEMI and LEFT ANTI join types although the right side
output would not be used). This is incorrect, and now the merge
joiner outputs batches with the correct number of columns.

A similar issue was present with LEFT SEMI hash joiner and is now
fixed.

Release note: None

Co-authored-by: Yahor Yuzefovich <yahor@cockroachlabs.com>
@craig
Copy link
Contributor

craig bot commented Aug 15, 2019

Build succeeded

@craig craig bot merged commit 5a7955f into cockroachdb:master Aug 15, 2019
@yuzefovich yuzefovich deleted the fix-left-mj branch August 30, 2019 19:38
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.

3 participants