Repository navigation
fix(sql): support bounded deep existential predicates - #28364
Conversation
Support the two-level WHERE existential cases in issue matrixorigin#28293 with typed SEMI/MARK lowering and bounded existence summaries. Preserve legacy admission and metadata, and validate duplicate/NULL/empty semantics, distributed execution, lifecycle and performance.
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
Merge Queue Status
This pull request spent 15 minutes 54 seconds in the queue, with no time running CI. Waiting for
All conditions
ReasonThe pull request can't be updated
Failing checks:
HintYou should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again. Tick the box to put this pull request back in the merge queue (same as
|
## What type of PR is this? - [ ] API-change - [ ] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue #28378 ## What this PR does / why we need it: Add regression coverage for queued stream cancellation, shuffle receiver retirement, and distributed IVF query cleanup. Production fixes are already present through #28358, the relevant dispatch/remote pipeline changes in #28364, and #28539; this PR changes tests only and does not establish their individual causal contribution to the original TKE incident. - Observe serialized MORPC sequence numbers after a queued message is canceled. The identical test compiles on the #28358 parent and fails with expected sequence 2 versus actual 3. - Cover first, middle, last, and consecutive shuffle receiver retirement, checking both subsequent sends and one-time notification. Exercise query/connection cancellation during real receiver credit waiting through the CN handler, preserving the terminal error and releasing lifecycle registration. - Add a two-CN IVF test with 256 128-dimensional vectors. The representative L2 case exercises eight concurrent sessions with one simultaneous query per session; cosine, normalized L2, and raw-vector IP/normalized-query retain their per-distance lifecycle and result checks. The test covers exact full-probe comparison, approximate-result validity, empty results, and subsequent queries. Test preparation failure uses the actual phase runner, transaction rollback, worker exit, and database cleanup. Preparation and query budgets are cumulative but separate; cleanup gets its own context. SQL pre-cancellation is not presented as proof of active remote cancellation. The fixture provides 16 vectors per IVF list on average; Vector Index Scan selects Multi-CN without a 65,536-row threshold, so the 256-row fixture preserves the lifecycle and result oracles while bounding the owning package's race cost. - Extend test/distributed/cases/vector/vector_ivf_multicn_search.sql and .result with cosine, raw-vector IP/normalized-query, empty-result, and follow-up checks. The GROUP_CONCAT metadata expectation uses the existing server TEXT mapping and Connector/J 8.0.15 metadata; results were not regenerated blindly. Validation (final file contents include the follow-up assertion, SCA, coverage-budget, fixture-size, and concurrency-budget fixes; exact head 323daee; upstream base 07b2596; product base 2a6fe7f): - macOS arm64, Go 1.26.4, repository CGo wrapper, GOMAXPROCS=4, test package parallelism 1. - New mechanism tests: ordinary 100 iterations and race 20 iterations passed. MORPC, dispatch, and compile packages passed ordinary/race checks; unchanged evidence was reused. - Follow-up P2 validation: TestRemoteNotifyCancellationReleasesCreditWaitAndRegistration passed ordinary 100 iterations and race 20 iterations after asserting that connection cancellation closes proc.Ctx, records a non-nil ErrStreamClosed cause, and preserves it through repeated terminal cleanup. - After the follow-up edit, the complete owning ./pkg/sql/compile package passed once under the race detector; no race report was emitted. - Exact prior-head fixture validation: GOWORK=off go test -mod=readonly -count=1 -timeout=15m -run '^TestIssue28378IVFFlatRemoteLifecycle$' ./pkg/tests/issues passed in 14.855s; the same exact test with -race and a 20m timeout passed in 34.817s. After the first fixture-size change, the 1,024-row test passed ordinary in 16.675s and race in 33.739s; after the final 256-row/one-iteration change, it passed ordinary in 16.591s and race in 24.467s. - The MORPC parent counterexample validates the sequence mechanism. The IVF integration test is regression coverage, not a deterministic reproduction of the historical incident. - Reviewer P2 response: the fixture was reduced from 65,536 to 256 rows and the concurrent repeat count from two to one in 323daee. XuPeng-SH measured the prior 65,536-row test at 573.55s in the exclusive -p 1 -race UT stage on parent head 7944a5b; the focused runs above measure the latest local fixture at 16.591s ordinary and 24.467s race. These are different environments and modes, so the numbers are reported as bounded before/after evidence rather than a CI performance claim. The exact-head CI run below provides the Linux cost measurement. - Exact current-head CI run 34756863153 for f7cb131 passed Ubuntu UT, SCA, UT Coverage, shared build, Proxy/Pessimistic BVT, and CI Required. The subsequent exact-head run 34799486791 for 323daee passed on attempt 2: Ubuntu UT, SCA, UT Coverage, shared build, Proxy/Pessimistic BVT, Coverage, and CI Required are green. Its first attempt failed only in the unrelated optools TestUTHeartbeatStopsCleanly with `WaitDelay expired before I/O complete`; the failed Coverage chain passed on rerun without code changes. - Formal BVT: CN1 and CN2 JDBC entry points each passed 36/36 comparisons with full metadata checking. go vet, gofmt, and diff checks passed. Deployment evidence for the already-fixed product base, independently of this new test commit: - Old baseline run https://github.com/matrixorigin/mo-nightly-regression/actions/runs/34352473993: HNSW/L2/cosine/normalize errors were 0/1702/1266/588. - Fixed-product run https://github.com/matrixorigin/mo-nightly-regression/actions/runs/34464342049: all four original million-vector SIFT128 cases completed with 100 terminals, five-minute measurements, and zero client errors. The five data hashes match the failed baseline. Acceptance was checked from artifact counters and error files, not only workflow success. QA required: yes — distributed timing and deployed-workload acceptance. Automated terminal coverage includes completed SQL assertions, cancellation waiter exit, preserved terminal errors, registration removal, and cleanup. QA should review the target release's inclusion of the existing production fixes and the attached run evidence. First-error query/stream/peer correlation and unique root-cause attribution remain unavailable; this PR must not auto-close #28378. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…8364) ## What type of PR is this? - [ ] API-change - [x] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#28293 ## What this PR does / why we need it: Two-level existential filters whose innermost predicate references both its parent and grandparent currently fail during correlated-column pullup. This change admits a bounded set of WHERE EXISTS, NOT EXISTS and truth-only scalar IN predicates, including up to eight restricted innermost OR arms, and lowers them to SEMI/MARK joins without materializing the inner relation product. NULLs, empty inputs, outer duplicates and existing successful planning paths retain their semantics; unsupported shapes retain the existing rejection behavior. Repeated non-PK RIGHT SEMI/ANTI hash matches skip groups already completed in the worker-local bitmap. Distributed broadcast also retires explicitly stopped receivers without truncating delivery to remaining local or remote consumers, while preserving real query and transport errors. Validation before the main merge: full planner, dispatch and hashjoin packages; focused compile and race checks; 250/250 MySQL differential cases; 34/34 BVT statements twice; two-CN execution and cancellation/reuse twice. Merge validation is recorded in the linked report. Performance checks cover duplicate keys, high NDV, skew, asymmetric relation sizes, natural two-CN execution and existing planner paths. Tested cases show no statistically supported latency regression above 5%; this is not a universal bound. The outer-gated ANTI shape uses about 5.2 MB more hash memory (7.1%) at 4.5 million build rows for its Boolean hash key. See the [design](docs/rfcs/20260907_deep_existential_decorrelation.md) and [validation report](docs/rfcs/20260907_deep_existential_validation.md) for scope, measurements and limitations. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
## What type of PR is this? - [ ] API-change - [ ] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#28378 ## What this PR does / why we need it: Add regression coverage for queued stream cancellation, shuffle receiver retirement, and distributed IVF query cleanup. Production fixes are already present through matrixorigin#28358, the relevant dispatch/remote pipeline changes in matrixorigin#28364, and matrixorigin#28539; this PR changes tests only and does not establish their individual causal contribution to the original TKE incident. - Observe serialized MORPC sequence numbers after a queued message is canceled. The identical test compiles on the matrixorigin#28358 parent and fails with expected sequence 2 versus actual 3. - Cover first, middle, last, and consecutive shuffle receiver retirement, checking both subsequent sends and one-time notification. Exercise query/connection cancellation during real receiver credit waiting through the CN handler, preserving the terminal error and releasing lifecycle registration. - Add a two-CN IVF test with 256 128-dimensional vectors. The representative L2 case exercises eight concurrent sessions with one simultaneous query per session; cosine, normalized L2, and raw-vector IP/normalized-query retain their per-distance lifecycle and result checks. The test covers exact full-probe comparison, approximate-result validity, empty results, and subsequent queries. Test preparation failure uses the actual phase runner, transaction rollback, worker exit, and database cleanup. Preparation and query budgets are cumulative but separate; cleanup gets its own context. SQL pre-cancellation is not presented as proof of active remote cancellation. The fixture provides 16 vectors per IVF list on average; Vector Index Scan selects Multi-CN without a 65,536-row threshold, so the 256-row fixture preserves the lifecycle and result oracles while bounding the owning package's race cost. - Extend test/distributed/cases/vector/vector_ivf_multicn_search.sql and .result with cosine, raw-vector IP/normalized-query, empty-result, and follow-up checks. The GROUP_CONCAT metadata expectation uses the existing server TEXT mapping and Connector/J 8.0.15 metadata; results were not regenerated blindly. Validation (final file contents include the follow-up assertion, SCA, coverage-budget, fixture-size, and concurrency-budget fixes; exact head 323daee; upstream base 07b2596; product base 2a6fe7f): - macOS arm64, Go 1.26.4, repository CGo wrapper, GOMAXPROCS=4, test package parallelism 1. - New mechanism tests: ordinary 100 iterations and race 20 iterations passed. MORPC, dispatch, and compile packages passed ordinary/race checks; unchanged evidence was reused. - Follow-up P2 validation: TestRemoteNotifyCancellationReleasesCreditWaitAndRegistration passed ordinary 100 iterations and race 20 iterations after asserting that connection cancellation closes proc.Ctx, records a non-nil ErrStreamClosed cause, and preserves it through repeated terminal cleanup. - After the follow-up edit, the complete owning ./pkg/sql/compile package passed once under the race detector; no race report was emitted. - Exact prior-head fixture validation: GOWORK=off go test -mod=readonly -count=1 -timeout=15m -run '^TestIssue28378IVFFlatRemoteLifecycle$' ./pkg/tests/issues passed in 14.855s; the same exact test with -race and a 20m timeout passed in 34.817s. After the first fixture-size change, the 1,024-row test passed ordinary in 16.675s and race in 33.739s; after the final 256-row/one-iteration change, it passed ordinary in 16.591s and race in 24.467s. - The MORPC parent counterexample validates the sequence mechanism. The IVF integration test is regression coverage, not a deterministic reproduction of the historical incident. - Reviewer P2 response: the fixture was reduced from 65,536 to 256 rows and the concurrent repeat count from two to one in 323daee. XuPeng-SH measured the prior 65,536-row test at 573.55s in the exclusive -p 1 -race UT stage on parent head 7944a5b; the focused runs above measure the latest local fixture at 16.591s ordinary and 24.467s race. These are different environments and modes, so the numbers are reported as bounded before/after evidence rather than a CI performance claim. The exact-head CI run below provides the Linux cost measurement. - Exact current-head CI run 34756863153 for f7cb131 passed Ubuntu UT, SCA, UT Coverage, shared build, Proxy/Pessimistic BVT, and CI Required. The subsequent exact-head run 34799486791 for 323daee passed on attempt 2: Ubuntu UT, SCA, UT Coverage, shared build, Proxy/Pessimistic BVT, Coverage, and CI Required are green. Its first attempt failed only in the unrelated optools TestUTHeartbeatStopsCleanly with `WaitDelay expired before I/O complete`; the failed Coverage chain passed on rerun without code changes. - Formal BVT: CN1 and CN2 JDBC entry points each passed 36/36 comparisons with full metadata checking. go vet, gofmt, and diff checks passed. Deployment evidence for the already-fixed product base, independently of this new test commit: - Old baseline run https://github.com/matrixorigin/mo-nightly-regression/actions/runs/34352473993: HNSW/L2/cosine/normalize errors were 0/1702/1266/588. - Fixed-product run https://github.com/matrixorigin/mo-nightly-regression/actions/runs/34464342049: all four original million-vector SIFT128 cases completed with 100 terminals, five-minute measurements, and zero client errors. The five data hashes match the failed baseline. Acceptance was checked from artifact counters and error files, not only workflow success. QA required: yes — distributed timing and deployed-workload acceptance. Automated terminal coverage includes completed SQL assertions, cancellation waiter exit, preserved terminal errors, registration removal, and cleanup. QA should review the target release's inclusion of the existing production fixes and the attached run evidence. First-error query/stream/peer correlation and unique root-cause attribution remain unavailable; this PR must not auto-close matrixorigin#28378. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…8364) ## What type of PR is this? - [ ] API-change - [x] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#28293 ## What this PR does / why we need it: Two-level existential filters whose innermost predicate references both its parent and grandparent currently fail during correlated-column pullup. This change admits a bounded set of WHERE EXISTS, NOT EXISTS and truth-only scalar IN predicates, including up to eight restricted innermost OR arms, and lowers them to SEMI/MARK joins without materializing the inner relation product. NULLs, empty inputs, outer duplicates and existing successful planning paths retain their semantics; unsupported shapes retain the existing rejection behavior. Repeated non-PK RIGHT SEMI/ANTI hash matches skip groups already completed in the worker-local bitmap. Distributed broadcast also retires explicitly stopped receivers without truncating delivery to remaining local or remote consumers, while preserving real query and transport errors. Validation before the main merge: full planner, dispatch and hashjoin packages; focused compile and race checks; 250/250 MySQL differential cases; 34/34 BVT statements twice; two-CN execution and cancellation/reuse twice. Merge validation is recorded in the linked report. Performance checks cover duplicate keys, high NDV, skew, asymmetric relation sizes, natural two-CN execution and existing planner paths. Tested cases show no statistically supported latency regression above 5%; this is not a universal bound. The outer-gated ANTI shape uses about 5.2 MB more hash memory (7.1%) at 4.5 million build rows for its Boolean hash key. See the [design](docs/rfcs/20260907_deep_existential_decorrelation.md) and [validation report](docs/rfcs/20260907_deep_existential_validation.md) for scope, measurements and limitations. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
## What type of PR is this? - [ ] API-change - [ ] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#28378 ## What this PR does / why we need it: Add regression coverage for queued stream cancellation, shuffle receiver retirement, and distributed IVF query cleanup. Production fixes are already present through matrixorigin#28358, the relevant dispatch/remote pipeline changes in matrixorigin#28364, and matrixorigin#28539; this PR changes tests only and does not establish their individual causal contribution to the original TKE incident. - Observe serialized MORPC sequence numbers after a queued message is canceled. The identical test compiles on the matrixorigin#28358 parent and fails with expected sequence 2 versus actual 3. - Cover first, middle, last, and consecutive shuffle receiver retirement, checking both subsequent sends and one-time notification. Exercise query/connection cancellation during real receiver credit waiting through the CN handler, preserving the terminal error and releasing lifecycle registration. - Add a two-CN IVF test with 256 128-dimensional vectors. The representative L2 case exercises eight concurrent sessions with one simultaneous query per session; cosine, normalized L2, and raw-vector IP/normalized-query retain their per-distance lifecycle and result checks. The test covers exact full-probe comparison, approximate-result validity, empty results, and subsequent queries. Test preparation failure uses the actual phase runner, transaction rollback, worker exit, and database cleanup. Preparation and query budgets are cumulative but separate; cleanup gets its own context. SQL pre-cancellation is not presented as proof of active remote cancellation. The fixture provides 16 vectors per IVF list on average; Vector Index Scan selects Multi-CN without a 65,536-row threshold, so the 256-row fixture preserves the lifecycle and result oracles while bounding the owning package's race cost. - Extend test/distributed/cases/vector/vector_ivf_multicn_search.sql and .result with cosine, raw-vector IP/normalized-query, empty-result, and follow-up checks. The GROUP_CONCAT metadata expectation uses the existing server TEXT mapping and Connector/J 8.0.15 metadata; results were not regenerated blindly. Validation (final file contents include the follow-up assertion, SCA, coverage-budget, fixture-size, and concurrency-budget fixes; exact head 323daee; upstream base 07b2596; product base 2a6fe7f): - macOS arm64, Go 1.26.4, repository CGo wrapper, GOMAXPROCS=4, test package parallelism 1. - New mechanism tests: ordinary 100 iterations and race 20 iterations passed. MORPC, dispatch, and compile packages passed ordinary/race checks; unchanged evidence was reused. - Follow-up P2 validation: TestRemoteNotifyCancellationReleasesCreditWaitAndRegistration passed ordinary 100 iterations and race 20 iterations after asserting that connection cancellation closes proc.Ctx, records a non-nil ErrStreamClosed cause, and preserves it through repeated terminal cleanup. - After the follow-up edit, the complete owning ./pkg/sql/compile package passed once under the race detector; no race report was emitted. - Exact prior-head fixture validation: GOWORK=off go test -mod=readonly -count=1 -timeout=15m -run '^TestIssue28378IVFFlatRemoteLifecycle$' ./pkg/tests/issues passed in 14.855s; the same exact test with -race and a 20m timeout passed in 34.817s. After the first fixture-size change, the 1,024-row test passed ordinary in 16.675s and race in 33.739s; after the final 256-row/one-iteration change, it passed ordinary in 16.591s and race in 24.467s. - The MORPC parent counterexample validates the sequence mechanism. The IVF integration test is regression coverage, not a deterministic reproduction of the historical incident. - Reviewer P2 response: the fixture was reduced from 65,536 to 256 rows and the concurrent repeat count from two to one in 323daee. XuPeng-SH measured the prior 65,536-row test at 573.55s in the exclusive -p 1 -race UT stage on parent head 7944a5b; the focused runs above measure the latest local fixture at 16.591s ordinary and 24.467s race. These are different environments and modes, so the numbers are reported as bounded before/after evidence rather than a CI performance claim. The exact-head CI run below provides the Linux cost measurement. - Exact current-head CI run 34756863153 for f7cb131 passed Ubuntu UT, SCA, UT Coverage, shared build, Proxy/Pessimistic BVT, and CI Required. The subsequent exact-head run 34799486791 for 323daee passed on attempt 2: Ubuntu UT, SCA, UT Coverage, shared build, Proxy/Pessimistic BVT, Coverage, and CI Required are green. Its first attempt failed only in the unrelated optools TestUTHeartbeatStopsCleanly with `WaitDelay expired before I/O complete`; the failed Coverage chain passed on rerun without code changes. - Formal BVT: CN1 and CN2 JDBC entry points each passed 36/36 comparisons with full metadata checking. go vet, gofmt, and diff checks passed. Deployment evidence for the already-fixed product base, independently of this new test commit: - Old baseline run https://github.com/matrixorigin/mo-nightly-regression/actions/runs/34352473993: HNSW/L2/cosine/normalize errors were 0/1702/1266/588. - Fixed-product run https://github.com/matrixorigin/mo-nightly-regression/actions/runs/34464342049: all four original million-vector SIFT128 cases completed with 100 terminals, five-minute measurements, and zero client errors. The five data hashes match the failed baseline. Acceptance was checked from artifact counters and error files, not only workflow success. QA required: yes — distributed timing and deployed-workload acceptance. Automated terminal coverage includes completed SQL assertions, cancellation waiter exit, preserved terminal errors, registration removal, and cleanup. QA should review the target release's inclusion of the existing production fixes and the attached run evidence. First-error query/stream/peer correlation and unique root-cause attribution remain unavailable; this PR must not auto-close matrixorigin#28378. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…8364) ## What type of PR is this? - [ ] API-change - [x] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#28293 ## What this PR does / why we need it: Two-level existential filters whose innermost predicate references both its parent and grandparent currently fail during correlated-column pullup. This change admits a bounded set of WHERE EXISTS, NOT EXISTS and truth-only scalar IN predicates, including up to eight restricted innermost OR arms, and lowers them to SEMI/MARK joins without materializing the inner relation product. NULLs, empty inputs, outer duplicates and existing successful planning paths retain their semantics; unsupported shapes retain the existing rejection behavior. Repeated non-PK RIGHT SEMI/ANTI hash matches skip groups already completed in the worker-local bitmap. Distributed broadcast also retires explicitly stopped receivers without truncating delivery to remaining local or remote consumers, while preserving real query and transport errors. Validation before the main merge: full planner, dispatch and hashjoin packages; focused compile and race checks; 250/250 MySQL differential cases; 34/34 BVT statements twice; two-CN execution and cancellation/reuse twice. Merge validation is recorded in the linked report. Performance checks cover duplicate keys, high NDV, skew, asymmetric relation sizes, natural two-CN execution and existing planner paths. Tested cases show no statistically supported latency regression above 5%; this is not a universal bound. The outer-gated ANTI shape uses about 5.2 MB more hash memory (7.1%) at 4.5 million build rows for its Boolean hash key. See the [design](docs/rfcs/20260907_deep_existential_decorrelation.md) and [validation report](docs/rfcs/20260907_deep_existential_validation.md) for scope, measurements and limitations. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
## What type of PR is this? - [ ] API-change - [ ] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#28378 ## What this PR does / why we need it: Add regression coverage for queued stream cancellation, shuffle receiver retirement, and distributed IVF query cleanup. Production fixes are already present through matrixorigin#28358, the relevant dispatch/remote pipeline changes in matrixorigin#28364, and matrixorigin#28539; this PR changes tests only and does not establish their individual causal contribution to the original TKE incident. - Observe serialized MORPC sequence numbers after a queued message is canceled. The identical test compiles on the matrixorigin#28358 parent and fails with expected sequence 2 versus actual 3. - Cover first, middle, last, and consecutive shuffle receiver retirement, checking both subsequent sends and one-time notification. Exercise query/connection cancellation during real receiver credit waiting through the CN handler, preserving the terminal error and releasing lifecycle registration. - Add a two-CN IVF test with 256 128-dimensional vectors. The representative L2 case exercises eight concurrent sessions with one simultaneous query per session; cosine, normalized L2, and raw-vector IP/normalized-query retain their per-distance lifecycle and result checks. The test covers exact full-probe comparison, approximate-result validity, empty results, and subsequent queries. Test preparation failure uses the actual phase runner, transaction rollback, worker exit, and database cleanup. Preparation and query budgets are cumulative but separate; cleanup gets its own context. SQL pre-cancellation is not presented as proof of active remote cancellation. The fixture provides 16 vectors per IVF list on average; Vector Index Scan selects Multi-CN without a 65,536-row threshold, so the 256-row fixture preserves the lifecycle and result oracles while bounding the owning package's race cost. - Extend test/distributed/cases/vector/vector_ivf_multicn_search.sql and .result with cosine, raw-vector IP/normalized-query, empty-result, and follow-up checks. The GROUP_CONCAT metadata expectation uses the existing server TEXT mapping and Connector/J 8.0.15 metadata; results were not regenerated blindly. Validation (final file contents include the follow-up assertion, SCA, coverage-budget, fixture-size, and concurrency-budget fixes; exact head 323daee; upstream base 07b2596; product base 2a6fe7f): - macOS arm64, Go 1.26.4, repository CGo wrapper, GOMAXPROCS=4, test package parallelism 1. - New mechanism tests: ordinary 100 iterations and race 20 iterations passed. MORPC, dispatch, and compile packages passed ordinary/race checks; unchanged evidence was reused. - Follow-up P2 validation: TestRemoteNotifyCancellationReleasesCreditWaitAndRegistration passed ordinary 100 iterations and race 20 iterations after asserting that connection cancellation closes proc.Ctx, records a non-nil ErrStreamClosed cause, and preserves it through repeated terminal cleanup. - After the follow-up edit, the complete owning ./pkg/sql/compile package passed once under the race detector; no race report was emitted. - Exact prior-head fixture validation: GOWORK=off go test -mod=readonly -count=1 -timeout=15m -run '^TestIssue28378IVFFlatRemoteLifecycle$' ./pkg/tests/issues passed in 14.855s; the same exact test with -race and a 20m timeout passed in 34.817s. After the first fixture-size change, the 1,024-row test passed ordinary in 16.675s and race in 33.739s; after the final 256-row/one-iteration change, it passed ordinary in 16.591s and race in 24.467s. - The MORPC parent counterexample validates the sequence mechanism. The IVF integration test is regression coverage, not a deterministic reproduction of the historical incident. - Reviewer P2 response: the fixture was reduced from 65,536 to 256 rows and the concurrent repeat count from two to one in 323daee. XuPeng-SH measured the prior 65,536-row test at 573.55s in the exclusive -p 1 -race UT stage on parent head 7944a5b; the focused runs above measure the latest local fixture at 16.591s ordinary and 24.467s race. These are different environments and modes, so the numbers are reported as bounded before/after evidence rather than a CI performance claim. The exact-head CI run below provides the Linux cost measurement. - Exact current-head CI run 34756863153 for f7cb131 passed Ubuntu UT, SCA, UT Coverage, shared build, Proxy/Pessimistic BVT, and CI Required. The subsequent exact-head run 34799486791 for 323daee passed on attempt 2: Ubuntu UT, SCA, UT Coverage, shared build, Proxy/Pessimistic BVT, Coverage, and CI Required are green. Its first attempt failed only in the unrelated optools TestUTHeartbeatStopsCleanly with `WaitDelay expired before I/O complete`; the failed Coverage chain passed on rerun without code changes. - Formal BVT: CN1 and CN2 JDBC entry points each passed 36/36 comparisons with full metadata checking. go vet, gofmt, and diff checks passed. Deployment evidence for the already-fixed product base, independently of this new test commit: - Old baseline run https://github.com/matrixorigin/mo-nightly-regression/actions/runs/34352473993: HNSW/L2/cosine/normalize errors were 0/1702/1266/588. - Fixed-product run https://github.com/matrixorigin/mo-nightly-regression/actions/runs/34464342049: all four original million-vector SIFT128 cases completed with 100 terminals, five-minute measurements, and zero client errors. The five data hashes match the failed baseline. Acceptance was checked from artifact counters and error files, not only workflow success. QA required: yes — distributed timing and deployed-workload acceptance. Automated terminal coverage includes completed SQL assertions, cancellation waiter exit, preserved terminal errors, registration removal, and cleanup. QA should review the target release's inclusion of the existing production fixes and the attached run evidence. First-error query/stream/peer correlation and unique root-cause attribution remain unavailable; this PR must not auto-close matrixorigin#28378. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #28293
What this PR does / why we need it:
Two-level existential filters whose innermost predicate references both its parent and grandparent currently fail during correlated-column pullup. This change admits a bounded set of WHERE EXISTS, NOT EXISTS and truth-only scalar IN predicates, including up to eight restricted innermost OR arms, and lowers them to SEMI/MARK joins without materializing the inner relation product. NULLs, empty inputs, outer duplicates and existing successful planning paths retain their semantics; unsupported shapes retain the existing rejection behavior.
Repeated non-PK RIGHT SEMI/ANTI hash matches skip groups already completed in the worker-local bitmap. Distributed broadcast also retires explicitly stopped receivers without truncating delivery to remaining local or remote consumers, while preserving real query and transport errors.
Validation before the main merge: full planner, dispatch and hashjoin packages; focused compile and race checks; 250/250 MySQL differential cases; 34/34 BVT statements twice; two-CN execution and cancellation/reuse twice. Merge validation is recorded in the linked report.
Performance checks cover duplicate keys, high NDV, skew, asymmetric relation sizes, natural two-CN execution and existing planner paths. Tested cases show no statistically supported latency regression above 5%; this is not a universal bound. The outer-gated ANTI shape uses about 5.2 MB more hash memory (7.1%) at 4.5 million build rows for its Boolean hash key.
See the design and validation report for scope, measurements and limitations.