Fix left outer merge join wrong results with residual filters - #11358
Merged
Conversation
Fixes two defects in mergeJoinKvIter for left outer merge joins whose key runs contain duplicates and whose join condition carries a residual (non-merge-key) filter: 1. matchedLeft was overwritten on every pairing (matchedLeft = ok), so a later pairing in the same key run that failed the residual filter erased an earlier success, and the key-run transition then emitted a spurious null-extended row for a left row that had already matched. Now matchedLeft is only ever set within a run (matchedLeft || ok); the run-transition reset remains the sole reset point. 2. When the left iterator hit io.EOF while advancing past a completed left row in the match loop, the error was returned immediately, dropping the null-extended row owed to a final unmatched left row. Now the null-extended row for tmpKey is emitted before surfacing EOF, mirroring the compare loop's oldLeftKey handling. Both defects surface as wrong LEFT JOIN ... IS NULL anti-join results (phantom and missing orphans). Regression tests included; the identical plan executed by the GMS memory engine already returned correct results. Fixes #11350 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VpTxMfzCXHoM8ojJn5aQiv
Contributor
|
@angelamayxie DOLT
|
Contributor
|
@angelamayxie DOLT
|
Contributor
|
@angelamayxie DOLT
|
angelamayxie
marked this pull request as ready for review
July 29, 2026 00:04
Contributor
|
@angelamayxie DOLT
|
jycor
approved these changes
Jul 29, 2026
[auto-bump] [no-release-notes] dependency by angelamayxie
Contributor
|
@angelamayxie DOLT
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tests added in dolthub/go-mysql-server#3655
Fixes #11350
Based on #11351