Skip to content

fix(plan): decouple simple zone-map filter admission from estimates - #32012

Merged
XuPeng-SH merged 5 commits into
matrixorigin:mainfrom
ck89119:issue-31857-main
Nov 2, 2026
Merged

XuPeng-SH merged 5 commits into
matrixorigin:mainfrom
ck89119:issue-31857-main

Conversation

@ck89119

@ck89119 ck89119 commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

Related to #31857.

What this PR does / why we need it:

calcScanStats could discard non-primary-column block predicates when estimated block selectivity was 1, even when existing object/block zone maps could prune data. Admit safe direct column/runtime-constant comparisons and ranges independently of that estimate, including when statistics are unavailable. Preserve zone-map safety checks, row filtering, cost estimates, force/disable hints, and composite-key filters. No storage format changes.

Add planner regressions, persisted-object filtering tests, and a six-row SQL regression covering clustered/interleaved layouts, disjoint ranges, commuted comparisons, prepared-statement NULL/reuse, and explicit disabling.

Validation (Go 1.27.1, darwin/arm64):

  • Focused regressions, full pkg/sql/plan and pkg/vm/engine/readutil tests via mo-cgo-test, service build, vet, and incremental lint passed.
  • SQL BVT passed twice: 47/47 statements per run, with teardown verified. The clustered range drops from 3 blocks/6 rows to 1 block/2 rows; a disjoint range reads 0 blocks, while the interleaved control retains 3 blocks/6 rows.
  • Changed-block statement coverage: 42/43 (97.67%).
  • A local warm-cache, high-overlap control retained all 9 blocks/73,728 rows in both modes; median latency was 0.447 ms with pruning versus 0.445 ms disabled (100 samples each).

Pruning remains layout-dependent. This fixes a demonstrated admission defect, not a lack of non-key zone-map metadata; the original incident's exact cause remains unconfirmed. The cost check is not a cold-storage or large-scale performance guarantee.

Admit safe column-to-runtime-constant comparisons and ranges even when block selectivity is one or statistics are unavailable. Preserve cost estimates, safety checks, optimizer hints, and composite-key filters.

Add planner and persisted-object regressions plus SQL coverage for pruning, layout controls, and prepared parameter reuse.

Related to matrixorigin#31857.
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

Regenerate affected EXPLAIN checkpoints after admitting simple column predicates independently of block selectivity estimates. Preserve all SQL inputs and unrelated result checkpoints.
@XuPeng-SH

XuPeng-SH commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-local · superseded

Commit: 29f7309cdacbea43e29e1096b81b43454b01930d

Review discussion changed before publication; a fresh contextual review is queued.

@aunjgr aunjgr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed the complete change, including block-filter admission with absent statistics, the unchanged zone-map safety boundary, residual row filtering, composite-key preservation, hints, and SQL/golden coverage. No blocking findings. Reused exact-head CI and the focused author validation; no new local tests were run.

@XuPeng-SH

XuPeng-SH commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-local · done

Commit: 29f7309cdacbea43e29e1096b81b43454b01930d

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

mo-bot review · mo-bot-local · review

Commit: 29f7309cdacbea43e29e1096b81b43454b01930d

Assessment: approve

Completed the full assessment after confirming the previously inspected delta and consumers remain unchanged. The new discussion introduces no unresolved concern. Admission preserves semantic safety, residual filtering, hints, composite predicates and cost estimates.

Model: gpt-6-astra / xhigh

Session: 01a1869d-820c-7212-9788-aecfb86a4141 · slot 0 · generation 2

Validation:

  • Current frozen evidence records successful build, UT, coverage, SCA and both selected BVT groups.

  • Diff whitespace check passed: receipt 1793610376979450112-3.json.

  • Fixture audit passed: 47 statements, 13 independent row-result expectations and six scan-count oracles; receipt 1793610377034750831-3.json.

  • Saved review-plan.md and discussion-assessment.json covering all four discussion keys. Source remains clean.

Limitations:

  • No local MatrixOne tests were run; raw CI per-test logs were not supplied. Fixture checks validate expectations, not MatrixOne execution.

  • Author-reported warm-cache performance measurements were not independently reproduced.

@mergify mergify Bot added the queued label Nov 2, 2026
@mergify

mergify Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

🚫 Left the queue

50 min in the queue, with no time running CI.

So far

  • ✅ Entered the queue Mon 2 Nov, 09:07 · rule main · triggered by rule Automatic queue on approval for main
  • 🚫 Left the queue 09:57 · 29f7309

Reason

The pull request can't be updated

GitHub response: refusing to allow a GitHub App to create or update workflow .github/workflows/ci-scope-check.yml without workflows permission
GitHub only lets Mergify write to .github/workflows/ with the workflows permission. An organization owner can accept Mergify's pending permissions at https://dashboard.mergify.com/orgs/matrixorigin/repositories.

Hint

You should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

Tick the box to put this pull request back in the merge queue (same as @mergifyio queue).

  • Requeue this pull request

Times in UTC · dashboard · how the merge queue works

@mergify mergify Bot added dequeued and removed queued labels Nov 2, 2026
@XuPeng-SH
XuPeng-SH merged commit a5ab19c into matrixorigin:main Nov 2, 2026
@ck89119
ck89119 deleted the issue-31857-main branch November 2, 2026 10:50
XuPeng-SH added a commit that referenced this pull request Nov 10, 2026
## 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:

Related to matrixorigin/matrixflow#20285

## What this PR does / why we need it:

Adapt the simple ZoneMap-filter admission fix from #32012 to `4.2-dev`,
including the reader compatibility fixes needed to preserve query
results on this branch.

- Admit safe direct-column comparisons and ranges independently of
estimated block selectivity, including unavailable statistics. Retain
ZoneMap safety checks, residual row predicates, cost estimates, explicit
disabling, and composite-key filters.
- Preserve comparison direction for constant-left inequalities in both
ZoneMap and primary-key reader filters without mutating shared
expressions or function IDs. A planner-only backport returned no rows
for `100 < k` where `[150, 200, 201]` was expected; this PR includes the
consumer fix rather than shipping that unsafe backport.
- Conservatively retain objects/blocks with uninitialized ZoneMaps for
the newly admitted simple predicates, including sorted-key
early-stop/seek paths.
- Fail open for initialized legacy FLOAT/DOUBLE ZoneMaps containing NaN
bounds, which may hide ordinary values. Reuse the existing NaN-bound
guard in scalar equality, strict comparison, and range interfaces; cover
both object/block pruning and sorted seek/early-stop consumers,
including single-end NaN summaries and ordinary-summary controls.
- Add planner/reader regressions and a small SQL BVT covering
clustered/interleaved layouts, commuted comparisons, primary-key
controls, prepared-statement NULL/reuse, and disabled-filter controls.
Preserve existing composite-key assertions without relying on predicate
ordering.

Additional correctness fixes after rebase:

- Preserve pre-existing block filters when statistics are unavailable,
and only newly admit simple predicates in that case. Keep the existing
cost, index and hint policy when statistics are available.
- Treat folded values that cannot safely become literals as unprunable
for range, hash and list partitions. Keep shared expressions unchanged
and retain normal pruning for representable bounds.
- Avoid ordered-block seeking and early termination for FLOAT/DOUBLE
sort keys because NaNs can make the physical block order non-monotonic.
Keep object and per-block ZoneMap checks; avoid raw-byte Bloom and fast
PK row filters for scalar floating-point primary keys so signed zero and
NaN do not lose rows.

Validation on rebased `4.2-dev` (`c6606110e8`):

- Complete `pkg/partitionprune`, `pkg/sql/plan`,
`pkg/vm/engine/readutil` and `pkg/vm/engine/tae/index` tests passed in
normal and `-race` modes on Linux/amd64 with Go 1.26.6 and the
repository CGo wrapper.
- Gofmt, incremental go vet, repository molint, and golangci-lint 2.6.2
passed for those owners and direct consumers `pkg/vm/engine/disttae` and
`pkg/sql/compile` (0 lint issues).
- A private single-CN SQL probe passed the range-partition prepared
sequence `11 → NULL → 11` with default and disabled block filters. The
normal `optimizer/non_primary_zonemap.sql` BVT passed twice (77/77
each), with database teardown checked between runs.
- The four-block floating-point counterexample and legacy NaN summaries
are covered by injected metadata tests; the test establishes the reader
boundary, not an end-to-end default-sized legacy object reproduction.

The float safeguard may examine every block summary in a sorted float
object and leaves scalar float primary-key filtering to the residual
predicate. It does not claim to resolve separate pre-existing float
upsert-probe behavior. Real customer-scale performance and the new
remote CI run remain unverified.

Historical author validation on earlier revisions:

- On then-current `4.2-dev` base `fa6bc2bcd9`: complete `pkg/sql/plan`
and `pkg/vm/engine/readutil` tests pass with Go 1.26.4 and the
repository CGo wrapper; gofmt, incremental go vet, and golangci-lint
2.6.2 built with Go 1.26.4 pass (0 issues).
- The same candidate also passed both complete packages and an actual
binary build on deployed source baseline `10d204b876`.
- On that deployment-baseline binary,
`optimizer/non_primary_zonemap.sql` passed normal mo-tester comparison
twice (60/60 each); generated expectations were checked against
independent expected rows before comparison. Cleanup was verified
between runs.
- The three original source SQL statements, including explicit
permission predicates and request variables, returned the expected
results on a 15-row synthetic fixture. Default scans fell from 6
blocks/15 rows to 2 blocks/6, 3, and 4 rows respectively. The extra
retained all-NULL block is intentional conservative handling, not a
correctness failure. No forced `blockFilter=1` was used.
- Changed-line-intersecting coverage blocks: 55/56; statement-weighted
coverage of those blocks: 104/105 (99.05%). This is not branch or
whole-package coverage.

Evidence reuse: the only change between previously validated
`a860d63a97` and current base `fa6bc2bcd9` is the repeated Top/mergeTop
ordering-key fix (#32402). It does not change the planner/readutil
implementation or this BVT fixture; current-base package/static checks
were rerun, while deployment-baseline SQL/BVT evidence is retained with
its original revision attribution.

Limitations: local validation was macOS/arm64, single-node CPU mode.
Real 96-million-row latency, Linux/multi-CN, original-tenant permission
integration, the full BVT/EXPLAIN baseline suite, and full CI are not
claimed as validated. IDC Dev was not upgraded, restarted, or modified.
Real-data acceptance still requires a suitable environment.

Review follow-up validation: the new legacy-NaN regressions failed
before the fix and pass afterward. Complete `pkg/vm/engine/tae/index`,
`pkg/vm/engine/readutil`, and `pkg/sql/plan` tests pass with Go 1.26.4;
incremental vet/lint pass. New production changed-line-intersecting
coverage blocks are 8/8 (100%). The compatibility fixture injects
historical summary bytes into a valid object metadata layout: the
current writer no longer emits this legacy state, so no new-write SQL
test is presented as a reproduction. Existing integer BVT evidence is
reused; it is not a NaN SQL acceptance claim.

CI follow-up (run 42600602130): the BVT failures comprised stale EXPLAIN
expectations and a range-partition pruning consumer that passed
materialized Fold constants directly to the general expression executor.
Normalize the already-copied partition expressions using the existing
hash/list conversion helper; preserve original filters and partition
metadata. The new UT fails with the original executor error before the
fix. Refresh only generated EXPLAIN checkpoints for the new block
filters; all SQL row results and UPDATE/DELETE expectations remain
unchanged.

After merging `mo/4.2-dev` at `e4f70a7268`, the four complete owning
packages (`partitionprune`, `plan`, `readutil`, `tae/index`),
incremental vet/lint, and two local normal mo-tester runs of all 11
failed files passed (1187/1187 each), with database teardown checked
between runs. Changed-line-intersecting statement-weighted coverage is
116/118 (98.31%). The earlier CI coverage job was blocked by failed BVT
prerequisites and did not compute a verdict. These local checks do not
claim the next remote multi-CN run is green.

CI and rebase follow-up:

- Rebased onto 4.2-dev `5dc6dec013`. Restore the existing index-table
ZoneMap admission rule when optimizer statistics are unavailable, still
requiring a zonemappable expression and honoring `blockFilter=2`.
Default costs and residual row filters remain unchanged. This removes
the missing-prefix-filter plan differences seen in run 42726120209;
unavailable statistics is a source-supported explanation, though that
run did not log its stats state.
- Added nil/error-stats, disabled-hint, ordinary-table and
volatile-expression controls; a real index-only rewrite now checks
prepared and NULL `prefix_eq`/`prefix_in` block filters. Both focused
tests reproduce the missing-filter behavior before the change.
- Go 1.26.4 Linux/amd64: `plan`, `partitionprune`, `readutil`, and
`tae/index` owning packages passed normal and race tests. Final planner
tests were rerun after the test additions. Incremental gofmt, vet and
configured golangci-lint passed for these packages plus `disttae` and
`sql/compile`.
- Using the exact CI mo-tester revision `309a0ca650` against a private
three-CN embedded cluster through one CN, the four affected BVT files
passed: decimal 625/625, index 134/134, index-cast 73/73 and non-primary
ZoneMap 77/77. A persisted secondary-index SQL probe also verified
equality and unordered prepared `IN` with NULL, with block pruning
enabled and disabled. These local runs do not replace the remote Proxy
and multi-CN BVT jobs.

---------

Co-authored-by: XuPeng-SH <[email protected]>
XuPeng-SH pushed a commit that referenced this pull request Nov 10, 2026
## What type of PR is this?

- [ ] API-change
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [ ] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

Related to matrixorigin/matrixflow#20285

## What this PR does / why we need it:

Port the scalar NaN-ZoneMap safety fix identified during review of
#32419 to `4.1.6-hotfix`.

The defect also exists on this branch independently of the new planner
admission policy: its current writer can persist an initialized `[NaN,
NaN]` summary for a block containing `[NaN, 7]`. Scalar pruning then
incorrectly rejects ordinary value `7`. Unlike `4.2-dev`, this branch
also lacks the existing conservative `>=`/`<=` guards.

- Add the FLOAT/DOUBLE NaN-bound check at the `index.ZM` ownership
boundary.
- Fail open for scalar equality, `<`, `<=`, `>`, `>=`, and `Between`;
`InRange` inherits the safe comparisons for all open/closed bounds.
- Preserve finite/infinite ordinary-summary pruning and existing
uninitialized-summary behavior.
- Cover both the actual writer-produced metadata and injected historical
single-/double-ended NaN summaries through object/block filtering,
sorted summaries, seek, and early-stop checks.
- Add a two-row public SQL regression with default, explicitly enabled,
and disabled block-filter modes. The session hint is used only to
deterministically exercise the existing consumer, not as evidence of a
new default admission policy or performance improvement.

This is a minimal scalar-pruning fix. It does **not** backport the
#32012 planner-admission change, change the writer/storage format or
row-level NaN semantics, or redesign runtime-IN pruning.

Validation on base `ef9256eca2` (macOS/arm64, Go 1.26.4, CPU CGo):

- Native dependencies rebuilt from this branch. Focused regressions fail
on the original implementation and pass after the fix.
- Complete `pkg/vm/engine/tae/index`, `pkg/vm/engine/readutil`,
`pkg/sql/plan`, and `pkg/container/types` tests pass using the
repository CGo wrapper borrowed into the worktree (the older branch does
not contain it).
- gofmt, incremental go vet, and golangci-lint 2.6.2 built with Go
1.26.4 pass (0 issues).
- Original and patched binaries built with the same
Makefile/toolchain/native libraries. The original binary uses a Go
overlay restoring the sole production change, `zm.go`, to HEAD; no
working-tree rollback or 4.2 native artifacts are involved.
- Original SQL execution loses `7` in eight forced-block-filter cases
across FLOAT/DOUBLE equality, `>`, `>=`, and `BETWEEN`; disabled
controls return it. The small fixture's default mode does not reproduce
the failure, so no default-mode reproduction claim is made.
- The patched binary passes all 36 independent result assertions across
default/enabled/disabled modes.
- `optimizer/legacy_nan_zonemap.sql` expectations generated and
reviewed, then normal mo-tester comparison passes twice on the same
instance: **31/31, 31/31**, with database teardown verified between
runs.
- Production changed-line-intersecting coverage blocks/statements:
**18/18 (100%)**; this is not branch coverage.

Linux/multi-CN, full CI, and real business-data acceptance are not
claimed as validated. No IDC cluster was upgraded, restarted, or
modified.


### CI follow-up: error propagation and bounded embedded race execution

Related to #32433. The failed rerun exposed an independently
reproducible panic: INSERT binding asserted every error as
`*moerr.Error`, so a standard `context.DeadlineExceeded` triggered a
second panic. Use the existing `moerr.IsMoErrCode` guard and preserve
the original error. Regression controls retain both permitted legacy
fallback cases and reject fallback for other errors/upserts.

The release-branch runner previously admitted all packages through one
`go test -p8 -race` command. Run ordinary race packages first at the
requested parallelism, then execute embedded-cluster packages serially
with no overlap. This includes `pkg/embed`, `pkg/tests/*`, and the
existing `pkg/util/test` embedded owner. Preserve
race/short/tags/timeouts, the complete package inventory, concatenated
JSON reports and nonzero exit status; do not retry, skip tests, weaken
assertions, or increase timeouts. The non-race path is not split into
stages.

Follow-up validation (Go 1.26.4, macOS/arm64):

- Original error-propagation regression reproduces the exact
interface-conversion panic; fixed regression passes for deadline,
cancellation, ordinary errors, MO errors, and legacy-fallback
boundaries.
- Full planner/optools packages and focused race regressions pass;
incremental vet/lint (golangci-lint 2.6.2), gofmt and Bash 3.2 syntax
checks pass.
- Dispatcher and real-entry contract tests check package
boundaries/order, caller tags, failure/report propagation, cancellation
status, empty stages and invalid inputs. The actual filtered `go list`
inventory contains 421 packages: a mock-command execution through the
real dispatcher proves each appears exactly once (408 ordinary, 13
embedded). This inventory check is not a full UT run.
- The five CI-failed cluster cases pass with `-race -short -tags
matrixone_test -count=1 -p1`: `TestPitrCases`, `TestDeleteAndSelect`,
`TestClientDisconnectCancelsQueryAndRollsBack`, `TestAffectedRows`, and
`TestPartitionBasedShardCanBeCreated`. The cascade failure
`TestDataBranchDiffAsFile` also passes in a separate race run. Selected
package execution took approximately 17–22 seconds each; the latter test
took 33.81 seconds, excluding compilation.

These changes fix the demonstrated error-type panic and enforce a
bounded resource-admission contract. They do not prove the underlying
runner CPU/I/O/HAKeeper stall cause, full Linux CI success, or full-lane
timing acceptance. The original RPC incident remains tracked in #32433.
The previous rerun passed Proxy BVT and coverage; CI for the new commits
is pending.
XuPeng-SH pushed a commit that referenced this pull request Nov 12, 2026
…32550)

## 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:

Related to matrixorigin/matrixflow#21333

## What this PR does / why we need it:

Adapt two complementary optimizations to `4.1.6-hotfix`: reduce repeated
scalar CTE computation, and admit safe ZoneMap pruning independently of
estimated block selectivity.

This is **a target-branch adaptation, not a pure cherry-pick**. The
branch lacks the CTE-sharing prerequisite used by #32522. This PR
supplies a deliberately restricted prerequisite and adapts its
non-truncating LIMIT proof, rather than importing main's general CTE
materialization/spill subsystem. The ZoneMap portion adapts the
admission work from #32012/#32419, preserves the existing #32431
protections, and does not import partition behavior changes.

### Two separate commits

1. **Safe ZoneMap admission and reader protections** (`ce71f6e3bf`)
- Admit stable direct-column comparisons/ranges even with unhelpful or
missing statistics; preserve residual predicates and `blockFilter=2`
disabling.
- Normalize constant-on-left comparisons without mutating shared
expressions. Fail open for missing summaries and avoid unsafe
floating-key seek, early-stop, and raw-byte filtering paths.
   - Retain the previous admission policy for partition tables.
2. **Bounded scalar CTE sharing and LIMIT proof** (`9f19e6fb7c`)
- Match the same CTE declaration and actual bound source, including
snapshots, types, and column mappings. Require deterministic,
data-error-free producers with structurally at most one fixed-width row.
- Bound each query to one shared producer, 64 readers, 256 output
columns, and 64 KiB of fixed-width output. Unsupported,
correlated/recursive, volatile, early-stop, or otherwise unsafe shapes
remain inline.
- Admit a positive literal LIMIT only when it covers a structural
scalar/UNION ALL row bound. Statistics, OFFSET, and LIMIT itself do not
tighten that bound.
- Gather the final scalar result on the coordinator, project the compact
published schema, and remap each reader after pruning. Give each reader
a private copy through existing connector/spool machinery before
evaluating expressions: decimal casts can mutate input vector metadata.
- Preserve CTAS `HaveDDL=true` and same-transaction visibility. Do not
force CTAS onto multiple CNs, change terminal protocols, or add a
materialized source, spill store, or cross-query cache.

### Validation

Local validation used **Go 1.26.4**, worktree-built native libraries,
the CGo test wrapper, and golangci-lint 2.14.0 built with Go 1.26.4.

- Both complete incident queries, with their original schema and **12
synthetic rows**: base-table scans changed from **8/4 to 1/1**. Actual
CTAS produced 8/4 rows; business values and `SHOW CREATE TABLE` matched
the optimization-disabled controls. Unordered row-number assignments
were not used as an equality oracle.
- Two independent local CN processes: both complete source SELECTs
returned matching results from either coordinator. Actual remote
contribution was verified by zero local scan rows on one coordinator,
nonempty producer merge input, and matching business results—not merely
an `AP_MULTICN` label or a remote placeholder in EXPLAIN.
- ZoneMap fixture: clustered ranges read **1 block / 2 rows**, versus
**3 blocks / 6 rows** with filtering disabled. Interleaved ranges
correctly retained all three blocks. Commuted comparisons preserved
results.
- New BVT results were generated with mo-tester and verified twice:
**41/41** for scalar CTEs and **60/60** for ZoneMaps. Adjacent
ordinary/recursive CTE, recursive INSERT, and legacy NaN cases also
passed (**54 + 124 + 31 checks**, including the new CTE case in the
first group; none ignored).
- Planner tests cover 2/4/8-branch LIMIT boundaries, structural
unknown/overflow/cycle controls, source identity, pruning, and
unsafe-inline cases. Compiler/operator tests cover local/remote-shaped
producers, reader vector isolation, success/error/cancellation, partial
preparation/publication, and zero residual mpool usage. Targeted race
checks passed.
- `go vet`, incremental lint, gofmt, and diff checks passed.
Changed-line coverage mapped through Go coverage blocks is **519/616 =
84.25%**; affected-block statement coverage is **434/505 = 85.94%**.

**Known baseline test failures:** the initial related-package run hit
these three Parquet tests. The same failures were reproduced on a clean
`54feca6423` worktree with matching Go/native inputs. The subsequent
related-package run passed while explicitly excluding only these tests;
no test was disabled or weakened in the committed code:

- `TestCompileExternScanParquetLoadUsesRowGroupFanoutWithEmptyFiles`
-
`TestCompileExternScanParquetRowGroupFanoutValidatesEmptyFileColumnCount`
- `TestCompileExternScanParquetLoadUsesFileFanoutMainPath`

The package selection covered planner, compiler, readutil, TAE index,
dispatch, merge, connector, pSpool, and process. This is not a claim
that the unfiltered full suite or CI is green.

### Limits of the evidence

No production deployment, production CTAS/DML, or production-scale
latency/throughput/memory acceptance was performed. The small local
fixtures establish plan, result, metadata, and lifecycle behavior; they
do not establish a production wall-clock speedup. Customer SQL, local
evidence, credentials, and build/data artifacts are not included in this
PR.

### P2 review follow-up: concurrent copying of a broadcast batch

Addressed in
[`c8e4f588b7`](c8e4f58),
after merging latest target `bf18d10904` (nullability inference).

- Confirmed the review finding: `GetCopiedBatch` moved `ExtraBuf` out of
its source, so multiple reader connectors copying a broadcast batch
raced even with nil metadata. Both a minimal spool regression and the
real compiler/connector path failed under `-race -count=1`. This proves
a data race, not an observed wrong SQL result or crash.
- Fix the common copy owner with `slices.Clone(src.ExtraBuf)`. Source
metadata is read-only; destinations own independent backing. No reader
serialization, if-nil workaround, or terminal-protocol change. Nonempty
metadata copying costs O(metadata bytes); the scalar fixed-width output
bound is not a general bound on serialized metadata.
- Regressions now run the **copy phase concurrently** rather than only
modifying completed copies concurrently. Cover nil/empty/nonempty
metadata, source preservation, non-aliasing, cache reuse, 4/8 real
readers, error/cancellation/partial preparation/publication, and zero
residual mpool usage. Each exact concurrency test passed **100 race
repetitions**.
- Spool/compiler owning normal/race checks passed with the same three
previously disclosed unrelated Parquet failures explicitly excluded from
compiler selection. Unfiltered runs retain those failures; no repository
test was disabled or weakened. Connector/dispatch/process race, merged
plan/function/group normal tests, vet and incremental lint passed.
Changed-production line coverage against the latest base is **520/617 =
84.28%**; the copy fix is **1/1 = 100%**.
- On a fresh local service, complete scalar CTE, ZoneMap and CTAS
fixtures passed twice: **41**, **60**, and **1,284** successful checks
respectively per round, with **30 pre-existing CTAS ignores** and zero
failures. An initial CTAS run with an inappropriate private default
database was excluded; the final runs used no JDBC default database,
preserving privilege/no-database assertions without changing
SQL/results.
- Rebuilt and revalidated both complete incident queries on the merged
base: one base scan each, actual CTAS 8/4 rows, matching business values
and table metadata versus disabled-optimization controls, plus two-CN
remote contribution/result checks. No production access or
production-scale performance acceptance. Post-push CI and maintainer
design approval are not claimed.

### Versioned design and approval status

- **Repository design document:** [v3-public.3 — scalar CTE sharing and
safe ZoneMap
admission](https://github.com/matrixorigin/matrixone/blob/c8e4f588b798984c2068802a1d20c2f682972e1e/docs/design/CLAUDE_32550_scalar_cte_zonemap_design.md)
(`docs/design/CLAUDE_32550_scalar_cte_zonemap_design.md`). This
commit-pinned repository file is the authoritative design; the earlier
v3-public.1 PR comment is historical, not the formal document location.
- The document binds base `54feca6423`, implementation `9f19e6fb7c`, and
expectation-only fix `35edb87c48`. Revision v3-public.2 moved the
document into the repository; v3-public.3 adds the source-immutable
metadata-copy contract, review regression, and merged-base validation in
section 10.
- Approval provenance: the requester approved local v3 with “go ahead”
before implementation and authorized delivery with “go on”. These are
private-session scope/implementation authorizations, **not a maintainer
design approval**; no public link to that private exchange is claimed.
- **Maintainer design approval: pending.** XuPeng-SH is requested as
reviewer. Please review **v3-public.3 at the pinned repository
revision** and record approval/requested changes on GitHub. Publishing
the document does not itself close the design-gate blocker.
- Review item 1 (EXPLAIN expectations) was addressed in `35edb87c48`:
the 10 affected cases passed twice locally, each with 999 successes,
zero failures, and eight unchanged pre-existing decimal ignores.

This branch was successfully deployed

No deployments
ci — 3d85b500 Deployed Nov 2, 2026 by XuPeng-SH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working size/L Denotes a PR that changes [500,999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants