Repository navigation
fix(join): deduplicate MARK JOIN probe rows - #24277
Merged
mergify[bot] merged 1 commit intoMay 6, 2026
Merged
Conversation
ⓘ You've reached your Qodo monthly free-tier limit. Reviews pause until next month — upgrade your plan to continue now, or link your paid account if you already have one. |
gouhongshen
force-pushed
the
codex/fix-mark-join-exists-or
branch
from
May 6, 2026 03:31
7f74a66 to
fa09763
Compare
gouhongshen
force-pushed
the
codex/fix-mark-join-exists-or
branch
from
May 6, 2026 03:34
fa09763 to
bb7f0f1
Compare
aunjgr
approved these changes
May 6, 2026
aunjgr
left a comment
Contributor
There was a problem hiding this comment.
LGTM. The fix correctly addresses the row-inflation bug by aggregating the mark result across all build batches before emitting a single probe row.
Verified:
- Batch-size early-exit saves
probeIdx = ibefore processing rowi, so re-entry is correct ctr.batIdx = 0reset after each MARK probe row is correct since the inner loop always runs to completion- The non-MARK path correctly drops the now-unreachable
elsebranch - Test covers the exact scenario: duplicate matches split across build batches producing exactly one output row per probe row
Minor note (non-blocking): old MARK logic had rowCountIncrease++ inside the Rel != 0 branch of ResultCols (line 302 on main), meaning it incremented per mark-column rather than per row. With a single mark column it was harmless, but the new code fixes this implicitly by moving the increment outside the ResultCols loop.
gouhongshen
force-pushed
the
codex/fix-mark-join-exists-or
branch
from
May 6, 2026 05:00
bb7f0f1 to
7268d30
Compare
ghost
approved these changes
May 6, 2026
Contributor
Merge Queue Status
This pull request spent 11 seconds in the queue, including 1 second running CI. Required conditions to merge
|
fengttt
pushed a commit
to fengttt/matrixone
that referenced
this pull request
May 7, 2026
Correlated `EXISTS` subqueries are flattened into MARK JOINs. The loop join executor evaluated each build batch independently and emitted the same probe row once per build batch, so `EXISTS(A) OR EXISTS(B)` could inflate outer rows instead of acting as a boolean predicate.
This PR aggregates MARK JOIN condition results across all build batches before emitting the probe row. Each probe row now produces a single mark value (`true`, `NULL`, or `false`), preserving EXISTS/semi-join semantics. It also adds:
- unit tests covering duplicate matches split across build batches and MARK JOIN resume after the default output batch size
- a small BVT regression case with one outer row and 9000 inner rows, just enough to cross the 8192-row execution batch boundary
Validation:
- `CGO_CFLAGS="-I${ROOT}/thirdparties/install/include" CGO_LDFLAGS="-L${ROOT}/thirdparties/install/lib -Wl,-rpath,${ROOT}/thirdparties/install/lib" go test ./pkg/sql/colexec/loopjoin -coverprofile=/tmp/loopjoin_cover.out`
- `make build`
- `cd /Users/ghs-mo/MOWorkSpace/mo-tester && ./run.sh -p /Users/ghs-mo/MOWorkSpace/matrixone-3rd/test/distributed/cases/ -m genrs -i issue_24219`
- `cd /Users/ghs-mo/MOWorkSpace/mo-tester && ./run.sh -p /Users/ghs-mo/MOWorkSpace/matrixone-3rd/test/distributed/cases/ -i issue_24219`
- local TPC-DS repro with `../tpcds`: `web_exists_count=0`, `catalog_exists_count=1`, `or_exists_count=1` after the fix
- TPC-DS query10 matches the PG golden result modulo CHAR padding whitespace
Approved by: @aunjgr, @heni02
1 task done
VioletQwQ-0
pushed a commit
to VioletQwQ-0/matrixone
that referenced
this pull request
Sep 17, 2026
Correlated `EXISTS` subqueries are flattened into MARK JOINs. The loop join executor evaluated each build batch independently and emitted the same probe row once per build batch, so `EXISTS(A) OR EXISTS(B)` could inflate outer rows instead of acting as a boolean predicate.
This PR aggregates MARK JOIN condition results across all build batches before emitting the probe row. Each probe row now produces a single mark value (`true`, `NULL`, or `false`), preserving EXISTS/semi-join semantics. It also adds:
- unit tests covering duplicate matches split across build batches and MARK JOIN resume after the default output batch size
- a small BVT regression case with one outer row and 9000 inner rows, just enough to cross the 8192-row execution batch boundary
Validation:
- `CGO_CFLAGS="-I${ROOT}/thirdparties/install/include" CGO_LDFLAGS="-L${ROOT}/thirdparties/install/lib -Wl,-rpath,${ROOT}/thirdparties/install/lib" go test ./pkg/sql/colexec/loopjoin -coverprofile=/tmp/loopjoin_cover.out`
- `make build`
- `cd /Users/ghs-mo/MOWorkSpace/mo-tester && ./run.sh -p /Users/ghs-mo/MOWorkSpace/matrixone-3rd/test/distributed/cases/ -m genrs -i issue_24219`
- `cd /Users/ghs-mo/MOWorkSpace/mo-tester && ./run.sh -p /Users/ghs-mo/MOWorkSpace/matrixone-3rd/test/distributed/cases/ -i issue_24219`
- local TPC-DS repro with `../tpcds`: `web_exists_count=0`, `catalog_exists_count=1`, `or_exists_count=1` after the fix
- TPC-DS query10 matches the PG golden result modulo CHAR padding whitespace
Approved by: @aunjgr, @heni02
VioletQwQ-0
pushed a commit
to VioletQwQ-0/matrixone
that referenced
this pull request
Sep 17, 2026
Correlated `EXISTS` subqueries are flattened into MARK JOINs. The loop join executor evaluated each build batch independently and emitted the same probe row once per build batch, so `EXISTS(A) OR EXISTS(B)` could inflate outer rows instead of acting as a boolean predicate.
This PR aggregates MARK JOIN condition results across all build batches before emitting the probe row. Each probe row now produces a single mark value (`true`, `NULL`, or `false`), preserving EXISTS/semi-join semantics. It also adds:
- unit tests covering duplicate matches split across build batches and MARK JOIN resume after the default output batch size
- a small BVT regression case with one outer row and 9000 inner rows, just enough to cross the 8192-row execution batch boundary
Validation:
- `CGO_CFLAGS="-I${ROOT}/thirdparties/install/include" CGO_LDFLAGS="-L${ROOT}/thirdparties/install/lib -Wl,-rpath,${ROOT}/thirdparties/install/lib" go test ./pkg/sql/colexec/loopjoin -coverprofile=/tmp/loopjoin_cover.out`
- `make build`
- `cd /Users/ghs-mo/MOWorkSpace/mo-tester && ./run.sh -p /Users/ghs-mo/MOWorkSpace/matrixone-3rd/test/distributed/cases/ -m genrs -i issue_24219`
- `cd /Users/ghs-mo/MOWorkSpace/mo-tester && ./run.sh -p /Users/ghs-mo/MOWorkSpace/matrixone-3rd/test/distributed/cases/ -i issue_24219`
- local TPC-DS repro with `../tpcds`: `web_exists_count=0`, `catalog_exists_count=1`, `or_exists_count=1` after the fix
- TPC-DS query10 matches the PG golden result modulo CHAR padding whitespace
Approved by: @aunjgr, @heni02
VioletQwQ-0
pushed a commit
to VioletQwQ-0/matrixone
that referenced
this pull request
Sep 17, 2026
Correlated `EXISTS` subqueries are flattened into MARK JOINs. The loop join executor evaluated each build batch independently and emitted the same probe row once per build batch, so `EXISTS(A) OR EXISTS(B)` could inflate outer rows instead of acting as a boolean predicate.
This PR aggregates MARK JOIN condition results across all build batches before emitting the probe row. Each probe row now produces a single mark value (`true`, `NULL`, or `false`), preserving EXISTS/semi-join semantics. It also adds:
- unit tests covering duplicate matches split across build batches and MARK JOIN resume after the default output batch size
- a small BVT regression case with one outer row and 9000 inner rows, just enough to cross the 8192-row execution batch boundary
Validation:
- `CGO_CFLAGS="-I${ROOT}/thirdparties/install/include" CGO_LDFLAGS="-L${ROOT}/thirdparties/install/lib -Wl,-rpath,${ROOT}/thirdparties/install/lib" go test ./pkg/sql/colexec/loopjoin -coverprofile=/tmp/loopjoin_cover.out`
- `make build`
- `cd /Users/ghs-mo/MOWorkSpace/mo-tester && ./run.sh -p /Users/ghs-mo/MOWorkSpace/matrixone-3rd/test/distributed/cases/ -m genrs -i issue_24219`
- `cd /Users/ghs-mo/MOWorkSpace/mo-tester && ./run.sh -p /Users/ghs-mo/MOWorkSpace/matrixone-3rd/test/distributed/cases/ -i issue_24219`
- local TPC-DS repro with `../tpcds`: `web_exists_count=0`, `catalog_exists_count=1`, `or_exists_count=1` after the fix
- TPC-DS query10 matches the PG golden result modulo CHAR padding whitespace
Approved by: @aunjgr, @heni02
This branch was previously deployed
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.
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #24219
What this PR does / why we need it:
Correlated
EXISTSsubqueries are flattened into MARK JOINs. The loop join executor evaluated each build batch independently and emitted the same probe row once per build batch, soEXISTS(A) OR EXISTS(B)could inflate outer rows instead of acting as a boolean predicate.This PR aggregates MARK JOIN condition results across all build batches before emitting the probe row. Each probe row now produces a single mark value (
true,NULL, orfalse), preserving EXISTS/semi-join semantics. It also adds:Validation:
CGO_CFLAGS="-I${ROOT}/thirdparties/install/include" CGO_LDFLAGS="-L${ROOT}/thirdparties/install/lib -Wl,-rpath,${ROOT}/thirdparties/install/lib" go test ./pkg/sql/colexec/loopjoin -coverprofile=/tmp/loopjoin_cover.outmake buildcd /Users/ghs-mo/MOWorkSpace/mo-tester && ./run.sh -p /Users/ghs-mo/MOWorkSpace/matrixone-3rd/test/distributed/cases/ -m genrs -i issue_24219cd /Users/ghs-mo/MOWorkSpace/mo-tester && ./run.sh -p /Users/ghs-mo/MOWorkSpace/matrixone-3rd/test/distributed/cases/ -i issue_24219../tpcds:web_exists_count=0,catalog_exists_count=1,or_exists_count=1after the fix