Skip to content

[#4] Add a new document: CHANGELOG.md - #5

Merged
yingfeng merged 2 commits into
matrixorigin:mainfrom
JinHai-CN:20210322_1
Mar 22, 2021
Merged

yingfeng merged 2 commits into
matrixorigin:mainfrom
JinHai-CN:20210322_1

Conversation

@JinHai-CN

@JinHai-CN JinHai-CN commented Mar 22, 2021 •

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:

Fixes #4

What this PR does / why we need it:

Add a new document: CHANGELOG.md

Special notes for your reviewer:

Not Available

Additional documentation (e.g. design docs, usage docs, etc.):

Not Available

Signed-off-by: jinhai <[email protected]>
@JinHai-CN
JinHai-CN requested a review from yingfeng March 22, 2021 07:35
@yingfeng
yingfeng merged commit d24000e into matrixorigin:main Mar 22, 2021
@JinHai-CN JinHai-CN changed the title Add a new document: CHANGELOG.md [4] Add a new document: CHANGELOG.md Mar 23, 2021
@JinHai-CN JinHai-CN changed the title [4] Add a new document: CHANGELOG.md [#4] Add a new document: CHANGELOG.md Mar 23, 2021
JinHai-CN added a commit that referenced this pull request Mar 24, 2021
* Update README.md

Signed-off-by: jinhai <[email protected]>

* Initiate CHANGELOG.md

Signed-off-by: jinhai <[email protected]>
yingfeng pushed a commit that referenced this pull request Aug 18, 2021
* Update README.md

Signed-off-by: jinhai <[email protected]>

* Initiate CHANGELOG.md

Signed-off-by: jinhai <[email protected]>
jiangxinmeng1 referenced this pull request in jiangxinmeng1/matrixone Apr 18, 2022
* (tae): fix dedup

* (tae): fix dedup

* (tae): add some prints
jiangxinmeng1 referenced this pull request in jiangxinmeng1/matrixone Apr 29, 2022
* (tae): fix dedup

* (tae): fix dedup

* (tae): add some prints
zhangxu19830126 referenced this pull request in zhangxu19830126/matrixone Oct 14, 2022
update logservicedriver config, update retry timeout
zengyan1 referenced this pull request in zengyan1/matrixone Mar 27, 2023
ouyuanning pushed a commit that referenced this pull request Oct 25, 2024
@ghost ghost mentioned this pull request May 29, 2026
1 task done
@LeftHandCold LeftHandCold mentioned this pull request Jun 4, 2026
1 of 7 tasks
XuPeng-SH added a commit that referenced this pull request Oct 10, 2026
)

Opt-in embedded MO-reader queries now lower MO exact Decimal64/128/256
values and descriptors to Sirius GPU execution. One immutable
capability-scoped profile owns admission, physical types/literals, bound
scalar/aggregate overloads, input publication, result reconstruction and
public numeric error classes. Terminal evidence records verified
descriptors and a schema digest without logging headings or values.

This implements approved PR C from #29690 and the versioned
[design/validation
map](https://github.com/matrixorigin/matrixone/blob/a4e34ef05de6a6d02ceb0fa81219cacd452ae6c8/docs/design/sirius-mo-exact-lowering.md).
Physical width is preserved at narrow declared precision; MO-bound
division metadata and 32-byte Decimal256 coefficients use the existing
credit-before-copy and borrowed-result contracts. Embedded fetch
defaults and DATE extraction use supported native wire forms.

All prerequisites are merged and inherited:

- Sirius [#29](matrixorigin/sirius#29):
`908ffc75a58b3be496b2172795e416326416e7ec`, with merged importer #5 at
`99c7ca3b6f8f3159239e119ed2982d42f98c4690`.
- Kernel [#29775](#29775):
`af3f7232a31879a2d6ed590785c8e9a560361c3f`. Prepared SELECT metadata
comes from the executed generation; incomplete saved SELECTs clear
session state before reuse.
- Main [#29794](#29794)
supplies the existing MORPC shutdown-test race correction. Main now also
includes the histogram-export synchronization fix; C uses main's bounded
two-send notification wait unchanged.

Final release/native integration at executable C head `ad61b5b5d3`, on
merged-kernel main `af3f7232a3`, passes:

- Default, Sirius-only and combined Sirius/cuVS release builds. The
clean merged SDK, all 73 fingerprints, compiler/header/proto identity
and runtime package/provenance guards pass.
- All 22 native preparations without reader/GPU-task admission. The
complete public MySQL numeric fixture passes exact values,
metadata/NULLs, arithmetic/aggregates/joins/sort, operation-owned
errors, masked errors, healthy reuse and prepared division increments
0/4/10/30/4. Native MO supplies the independent oracle.
- All 31 public terminal events show capability 31,
`mo-exact-decimal-v1`, completed GPU tasks, no fallback, healthy cleanup
and zero retained input/result credit.
- Four C-owning packages plus frontend pass default normal/race checks;
native-tag owning checks and the complete combined bridge suite pass.
cuVS-before/Sirius/cuVS-after passes in one process.
- All nine public prepared-metadata/saved-result cases pass normal mode
and three race repetitions, including a real persisted-batch failure
followed by successful save/replay on the same physical connection.
- Native data/cancellation passes 68 race repetitions in one process
(measured 0.44s; 30s budget). The exact MORPC shutdown test passes 100
race repetitions. Metrics focused/owning normal/race and 100 focused
race repetitions pass.

The delivered head is `b34111b4c9e94cda034d199a2c362072fe98d808`,
normally merged with authoritative main
`e5dd4724f782067e1c76c38c9d2f55cebceda4a9`. Review fixes are committed
in `af4f342066`: typed DATE lowering preserves persisted MO zero dates;
exact CASE retains the MO-bound descriptor around IfThen; ordinary
embedded integer add/subtract/multiply declines before readers because
the pinned consumer does not implement MO checked overflow. Flight
encoding/admission, reader bytes, native ABI and the merged Sirius pin
are unchanged.

The installed and loaded host drivers now both report NVIDIA 615.78.08;
final GPU checks run directly with the installed driver. The bounded
local native fixture uses 256 MiB GPU and 2 GiB host capacity. An
initial 512 MiB host fixture correctly rejected larger progress-window
reservations; only the test fixture was corrected. Production windows,
limits and assertions remain unchanged.

Review-resolution validation at prior head `a4e34ef05d`:

- Both incoming counterexamples have real GPU red/green proof. Zero DATE
now returns 0/0/0 alongside year-0001/leap-day/year-9999/NULL controls,
with SQL mode restored. Nullable division conditions with two required
decimal arms execute with native-MO values and nullable DECIMAL(15,2)
metadata.
- The existing public fixture covers integer +/-/* overflow declines and
healthy integral/decimal reuse. No new cluster, production hook, native
library dependency, sleep or skip was added.
- All 22 native preparations pass. Full public GPU normal mode passes
(9.596s); measured race mode followed by three in-process repetitions
passes (29.571s). Its 34 terminal events verify exact
profile/capability31, completed GPU work, no fallback, healthy cleanup
and zero retained input/result credits.
- Fresh combined release/native provenance and full bridge/coexistence
pass. Exporter/compiler/CN owning normal/race, focused new wire/domain
regressions, config and full mandatory pre-push SCA pass with zero lint
findings. Self-review has no unresolved implementation blocker.

**Ready for review; merge gates remain required CI and reviewer
approval.** Both incoming findings were reproduced on actual GPU/public
MySQL and fixed with regressions. A separate admitted integer-overflow
counterexample returned -2 instead of native MO 1690/22003; it now
declines before execution. Fresh CI is pending for the delivered head,
and the reviewer has been asked to reassess the fixes. Local passes do
not establish required CI success.

C remains opt-in. D begins after C merges and stays one complete public
campaign PR for all-22 SF1/SF10, bounded comparison,
lifecycle/resource/process evidence and performance gates. E/F retain
their separate recovery-readiness design. References #28968 and #28966;
neither issue is closed by C.


Conflict resolution at `b34111b4c9` (2026-10-10): normally merged
authoritative main `e5dd4724f7`. The single conflict was two equivalent
asynchronous histogram-test fixes; main's stopped-timer notification
barrier is retained unchanged. All 28 prior C paths were checked: only
this test changed, while the DATE/CASE/integer review fixes and merged
native pins remain intact.

Validation at this merged head passes: affected owning packages
normal/race, 100 focused metrics race repetitions, fresh native
generations and combined release/package, all 22 actual preparations
(1.116s), full public GPU normal/race (9.762s/11.999s), and full
combined bridge/coexistence (1.108s). Both public runs' 34 terminal
events verify completed GPU work, exact profile/capability31, healthy
cleanup, no fallback and zero retained credits. Mandatory pre-push SCA
passes with zero findings; self-review has no unresolved implementation
blocker. New-head required CI and human reviewer approval remain the
merge gates.

---------

Co-authored-by: XuPeng-SH <[email protected]>
XuPeng-SH pushed a commit that referenced this pull request Oct 30, 2026
…#31739)

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

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

### Problem

`DECIMAL` column declarations silently dropped the parsed `UNSIGNED` and
`ZEROFILL` attributes:

- `DECIMAL(10,2) UNSIGNED` accepted and stored negative values under
every `sql_mode`, where MySQL rejects them with `ERROR 1264 (22003) Out
of range value`.
- `DECIMAL(10,2) ZEROFILL` produced no zero-padded output, and `SHOW
CREATE TABLE` / `information_schema.columns.COLUMN_TYPE` lost both
modifiers.
- `CAST(x AS DECIMAL(p,s) UNSIGNED|ZEROFILL)` was accepted, which MySQL
rejects outright with `ERROR 1064`.

### Root cause

Three coupled defects:

1. The plan-layer DECIMAL conversion (`getTypeFromAstWithoutCharset`)
selected decimal64/128/256 by precision and scale only, discarding the
parsed attributes, so the attribute never reached the persisted type,
assignment admission, or any presentation surface.
2. With no attribute on the type domain, every assignment path
(INSERT/UPDATE/LOAD/REPLACE/VALUES) had no unsigned rule to enforce,
SHOW CREATE / information_schema / result metadata had nothing to
render, and the CAST target grammar accepted spellings MySQL forbids.
3. The bootstrap upgrade framework had no versioned entry able to
reconcile persisted `information_schema.COLUMNS` view text on existing
clusters, and no admission gate for legacy CDC tasks during that
crossing.

### Changes

- **Attribute carrier**: `plan.Type.numeric_attributes` (proto field 14)
carries UNSIGNED/ZEROFILL from DDL through persistence, catalog cache,
table functions, arrowbridge/external readers, checkpoint tooling and
sysview.
- **Unsigned enforcement**: every assignment admission path enforces the
unsigned domain — strict mode rejects negatives with `ERROR 1264
(22003)` atomically (no partial writes), non-strict saturates to the
lower bound with a 1264 warning, `IGNORE` accepts; `ZEROFILL` implies
`UNSIGNED`. Executor cast saturates to the unsigned domain with scale
widening before negation.
- **Presentation**: SHOW CREATE and COLUMN_TYPE render the modifiers
(`decimal(10,2)`, `decimal(10,2) unsigned`, `decimal(10,2) unsigned
zerofill`); zero-padding is applied on all six decimal
serialization/export sites (text rows ×2, binary rows ×2 including
prepared, CSV and JSONLINE export) plus result-column display metadata.
- **CAST grammar**: `CAST(... AS DECIMAL(p,s) UNSIGNED|ZEROFILL)` is
rejected with `ERROR 1064 (42000)`, matching MySQL.
- **Upgrade crossing**: new version 4.0.18 (offset 1) one-shot
`information_schema.COLUMNS` reconciliation entry with legacy-CDC
admission gating, retained-target recheck, frozen-offset preservation
(`MinUpgradeVersion 4.0.7`, `RequiredProtocolVersion 126`), so upgraded
clusters decorate their persisted view text exactly once.

### Validation

- Primary regression, assigned base vs fixed: identical 8-section SQL
script plus server-side-prepared binary-row probe run against isolated
services built from (a) the unaltered base `3cf38889bc` (every defect
reproduced: negatives stored, modifiers dropped, no padding, CAST
accepted) and (b) this change (strict `ERROR 1264 (22003)` with zero
rows stored, non-strict clip to `0.00` + Warning 1264, modifiers
retained in SHOW CREATE/COLUMN_TYPE for masks 0/1/3, zero-padded text
and binary wire, both CAST spellings `ERROR 1064`, signed/NULL controls
unchanged).
- Focused BVT
`test/distributed/cases/dtype/decimal_unsigned_zerofill.test` (144
statements: strict/non-strict/IGNORE, modifier masks, wide widths,
defaults, UPDATE, NULL, CAST rejection, persistence, snapshot
compatibility): `TOTAL 144 SUCCESS 144 SUCCESS RATE 100%`; `mo-tester`
result regeneration byte-identical.
- Upgrade legs: `go test ./pkg/embed/ -run 'TestColumnsUpgrade'` — 7/7
PASS, including an ablation leg proving the 4.0.18 entry is solely
responsible for decoration (background COLUMNS maintenance suppressed,
undecorated predecessor verified) and a post-replacement-crash leg
proving view-content and tenant-progress roll back together with
idempotent restart replay; plus `go test ./pkg/bootstrap/...`, `go test
./pkg/hakeeper/`, and the v4_0_18 commit-fence unit subcase, all green.

### Residual risks

- The background `information_schema.COLUMNS/TABLES` maintenance walker
(kept enabled in production) also converges view text over time; the
upgrade entry owns the deterministic crossing and the ablation leg
proves its sole responsibility, but real-cluster non-upgrade convergence
remains upstream-owned behavior.
- Evidence scope: focused BVT and affected-package suites are green; the
full distributed dtype suite is left to CI. Signed-DECIMAL controls in
the focused file and sweeps show no behavior change for unmodified
columns.


### CI fix update (2026-10-29, commit 74a4105)

CI run 40845538549 at the previous head failed Matrixone UT Coverage (4
tests) and multi-CN e2e BVT (3 rows); all were caused by this PR and are
fixed in `74a4105d94`:

- **Bootstrap upgrade chaining**
(`pkg/bootstrap/service_upgrade_tenant.go`,
`pkg/bootstrap/custom_upgrade.go`):
`MaybeUpgradeTenant`/`UpgradeOneTenant` planning stopped at the frozen
consolidated v4.0.7 terminal entry, so tenants on older versions never
received the forward v4.0.18 upgrade and tenants already at 4.0.7
skipped it. Both paths now re-plan and run the v4.0.7 crossing on demand
until no pending v4.0.7 upgrade remains, and the frozen terminal entry
is skipped so the forward version still executes. Fixes
`TestCollationsMetadataUpgrade`,
`TestV407LoginRepairsTenantCreatedAfterUpgradeSnapshot`,
`TestCallerOwnedTenantUpgradeRollsBackAndRetries`,
`TestCatalogVersionOrderingUsesSemanticVersionAndOffset`.
- **Stale test expectations**
(`pkg/embed/catalog_view_identity_test.go`,
`pkg/embed/catalog_upgrade_paging_test.go`): assert the semantic final
version instead of hardcoded `4.0.7`; injected version samples
retargeted to 4.1.9/4.1.10/4.1.11 to preserve the
semantic-vs-lexicographic ordering check.
- **BVT expected results** (`test/distributed/cases/dml/show/show.test`,
`zz_accesscontrol/account_restricted.sql`): spliced the
unsigned-decimal-decorated `information_schema.COLUMNS` SHOW CREATE DDL
(Create View descriptor 18848 chars, +209) into the three expectations;
fixes show.test row 295 and account_restricted.sql rows 55/113.

Local verification: pkg/bootstrap package suite green; both embed tests
pass with `-v`; focused `decimal_unsigned_zerofill` BVT 144/144 pass via
mo-tester against a locally built instance; the three spliced SHOW
CREATE rows are byte-exact (18848 chars) against the live upgraded
instance.


### CI fix update #2 (2026-10-29, commit 0a05d68)

CI run 40862553192 at head 74a4105 failed `SCA Test on Linux/arm64`
(job 123409348216): `make static-check-selected` reported 9
static-analysis findings, all in files owned by this PR. Fixed in
`0a05d68642`:

- `pkg/container/arrowbridge/staging_text_test.go`: gofmt(simplify) —
collapse `decimal128.Num{}` to `{}` in the composite literal.
- `pkg/sql/plan/function/func_cast_unsigned_decimal.go`: ineffassign —
drop the dead `outcome` initializer (both classifier branches always
assign).
- `pkg/sql/plan/function/func_cast_unsigned_decimal_test.go`: two
ineffassign findings — discard results reassigned before use, rescope
the second JSON admission result.
-
`pkg/vm/engine/disttae/cache/catalog_column_update_numeric_attributes_test.go`:
prealloc — build the 5-column fixture slice in a single literal with
full capacity.
- `pkg/bootstrap/service_upgrade_crossing_test.go`: unused `inTxn` field
and `executionLog` accessor removed.
- `pkg/embed/upgrade_columns_4_0_18_test.go`: unused `readColumnsRoute`
/ `waitColumnsVersionReady` helpers and the orphaned `testify/assert`
import removed.

No behavior change. Local verification: `golangci-lint run -c
.golangci.yml` on the five affected packages reports 0 issues (the exact
CI gate); the targeted suites all pass — arrowbridge staging-text suite,
`pkg/sql/plan/function` TestUnsignedDecimalAdmission* +
TestCastDecimalExtremeExponentRendering, `disttae/cache`
TestColumnOnlyUpdateNeverDropsNumericAttributes, and `pkg/bootstrap`
TestCrossing*.

The same run's `UT Coverage on Ubuntu/x86` failure (job 123409393777)
and its downstream `Coverage` merge block are the known
`TestCrossTargetUpgradeRecovery` embedded-cluster admission flake
tracked in #31044 (comment below); the PR code does not execute in that
fixture-acquire failure.

### Base update (2026-10-29, merge commit 983cad4)

Main advanced with #31662 (`641c34d259`), which removed the periodic
`information_schema.COLUMNS/TABLES` repair walker and made the versioned
4.0.7 entry plus `CREATE ACCOUNT` initialization own convergence. That
removal conflicted with this PR's walker-ablation additions (which only
existed so upgrade scenario tests could attribute decoration to the
v4.0.18 entry). Merge `983cad4dc3` resolves it: the disable option,
gate, and struct field are dropped together with the ablation argument
at all 13 cluster-wiring call sites; with the walker gone, the scenario
tests' attribution premise holds unconditionally. This PR's v4.0.18
one-shot COLUMNS reconciliation entry is unchanged and is exactly the
supported convergence path on the new main.

Verification on the merged tree: `go vet` green on `pkg/bootstrap/...`,
`pkg/embed`, `pkg/frontend`; `golangci-lint` (repo config) reports 0
issues on `./pkg/bootstrap/...` and `./pkg/embed`; `pkg/bootstrap`
TestCrossing* and TestV407* pass;
`TestColumnsUpgradeAutomaticScenarioCompletion` passes as the
merged-premise end-to-end smoke.

The residual-risks note above mentioning the background walker "also
converges view text over time" is superseded: on current main the walker
no longer exists and the versioned entries own convergence.


### CI fix update #3 (2026-10-29, commit a15f2bf)

CI run 40880503711 at head 983cad4 (after the #31662 merge) failed
`UT Coverage on Ubuntu/x86` (job 123471690727):
`TestCreateAccountCatalogInitialization` in `pkg/tests/sqlintegration`
failed in 3.35s. That test was introduced by #31662 with a hard-coded
`create_version` expectation of `4.0.7`; this PR registers the v4_0_18
upgrade handle, so on the PR head `GetFinalVersion()` is `4.0.18` and
`CREATE ACCOUNT` stamps `mo_account.create_version = '4.0.18'` (bound to
`baseService.GetFinalVersion()` in `authenticate.go`). The stale literal
is updated to `4.0.18` in `a15f2bff2b`; the sibling scenario in
`collations_metadata_test.go` already compares against the dynamic
`upgrader.GetFinalVersion()` and passed in the same job. No
production-code change.


### CI fix update #4 (2026-10-30, commit 66bae00)

CI run 40902981503 at head a15f2bf failed `Matrixone Coverage
execution / Coverage` (job 123577267924): this PR's own diff coverage
measured 536/717 = 74.76%, below the 75% PR-coverage gate. The failure
is PR-caused (the gate only counts blocks this PR adds or modifies), so
the root cause is fixed with genuine test additions rather than any gate
change; nothing outside test files is touched:

- `pkg/sql/plan/function/func_cast_unsigned_decimal_test.go`:
admission-matrix coverage for the uncovered blocks in
`func_cast_unsigned_decimal.go` — signed fixed-width sources rejecting
negative rows (1264/22003) and pass-through for non-negative
float/int/uint/bool/bit rows; date/datetime/timestamp/enum decodes;
select-list row skipping across fixed, JSON, binary and varlena inputs;
binary decimal128/256 payload decoding and empty-payload errors; the
MySQL-prefix charset fast path; string outcome branches (pass through,
clip-to-zero with WARN_DATA_TRUNCATED + 1264 warnings under ignore
policy, and the fit-abstain path); varlena NULL rows; and the
nil-process out-of-range warning fallback.
- `pkg/container/arrowbridge/staging_text_test.go`: staged-text
rendering for the remaining Arrow scalar kinds (int8/16/32,
uint8/16/32/64, float16/32, decimal256), the rendered upper-bound table
for int/float/bool kinds plus its unsupported-source rejection, context
cancellation observed in both the whole-batch conversion and the
per-column staged loop, and row-budget rejection for unsupported staged
sources.
- `pkg/common/moerr/error_out_of_range_column_test.go` (new):
`NewOutOfRangeValueForColumnNoCtx` keeps the 1264/22003 wire contract
naming the column and 1-based row.
- `pkg/container/types/attributed_decimal_oid_test.go` (new):
`T.IsAttributedDecimalOid` accepts exactly the decimal family.

Local verification, reproducing the CI gate exactly: artifact profiles
from the failed run (UT + BVT pessimistic + BVT compose) merged by block
key with the profiles of these tests (same Go 1.27.1 toolchain), then
the CI `parse_coverage.py` rerun over this PR's diff: total 717 modified
blocks, covered 602, PR coverage 83.96% → pass (margin +9 points over
the gate). All named suites pass locally (arrowbridge staging-text file,
`pkg/sql/plan/function` TestUnsignedDecimalAdmission* +
TestAppendUnsignedDecimalOutOfRangeWarning*, moerr, types).

No production-code change; no CI/workflow change.


### Base update (2026-10-30, merge commit 8cc3ce9)

GitHub reported the PR CONFLICTING after main advanced with #31628 (FK
rebind to surviving keys, `969998e697`), #31738, #31746, #31766, #31767,
#31768, #31777. The only content conflict was
`pkg/sql/plan/build_ddl_test.go`: both sides appended independent test
functions after `TestSessionDatabaseNullability`. The resolution keeps
both — this PR's
`TestBuildCTASUnsignedDecimal{Attribute,SetOperation}Provenance` and
main's FK-rebind tests — with no changes to either test body.

All other shared files auto-merged on disjoint hunks, verified by
comparing both sides' diff regions against the merge base `641c34d259`:
`pkg/common/moerr/error{,_no_ctx}.go` (this PR's
`ErrOutOfRangeValueForColumn` 20211 vs main's `ErrDataBranchConflict`
22501, different code groups), `pkg/sql/plan/build_ddl.go` (this PR's
CTAS default/attribute region vs main's FK-rebind region), plus
`base_binder.go`, `build_alter_table.go`, `query_builder.go`, and
`pkg/vm/engine/disttae/txn_table.go`.

Local verification on the merged tree (Go toolchain, repo Makefile CGO
flags):

- `go build ./pkg/common/moerr/... ./pkg/sql/plan/...
./pkg/vm/engine/disttae/...` — green.
- `go test ./pkg/common/moerr/` — pass (covers both error-catalog
sides).
- `go test ./pkg/vm/engine/disttae/cache/ -run
TestColumnOnlyUpdateNeverDropsNumericAttributes` — pass (4 subtests).
- `go test ./pkg/sql/plan/ -run '<19-test seam regex>'` — all 19
top-level tests pass: this PR's 9 unsigned-decimal suites, main's 8
FK-rebind suites, `TestSessionDatabaseNullability`,
`TestBuildCTASPreservesMySQLSpecialColumnTypes`.

No production-code change in the resolution beyond the merge itself; no
CI/workflow change. Fresh CI on the new head was not awaited.


### CI fix update #5 (2026-10-30, commit 9d109f5)

CI run 40929677611 (attempt 1) at head 8cc3ce9 failed `Matrixone CI
execution / UT Test on Ubuntu/x86` (job 123645508612): package
`pkg/sql/plan/function` failed with `--- FAIL:
TestUnsignedDecimalAdmissionTemporalEnumAndUnsupportedSources` — `panic:
type mismatch: casting ENUM vector to []uint16` — and `CI Required`
failed as a consequence. The failure is PR-caused: the enum decode case
added in update #4 built its ENUM input vector through
`testutil.NewVector`, whose `T_enum` branch appends plain `uint16`;
`vector.AppendFixed[uint16]` trips the race-build
`checkTypeIfRaceDetectorEnabled` in `pkg/container/vector` (an
enum-typed vector is not type-compatible with `[]uint16`). UT runs with
`-race`, so the panic only fires there; local non-race runs passed,
which is how it escaped update #4. Production code is unaffected: the
admission path already reads enum vectors through
`unsignedDecimalAdmissionFixed[types.Enum]`.

Fix, test-only and one spot:

- `pkg/sql/plan/function/func_cast_unsigned_decimal_test.go`: construct
the enum source with `vector.NewVec(types.T_enum.ToType())` +
`vector.AppendFixed(types.Enum(7))`, the enum vector construction
already used elsewhere in the tree (e.g.
`pkg/sql/compile/fuzzyCheck_test.go`).

Local verification with the race detector (Go 1.27.1, repo Makefile CGO
flags):

- Before the fix: `go test -race -run
'^TestUnsignedDecimalAdmissionTemporalEnumAndUnsupportedSources$'
./pkg/sql/plan/function/ -count=1 -v` panics with the identical `type
mismatch: casting ENUM vector to []uint16` seen in the CI log.
- After the fix: the same command passes, and the full `go test -race
./pkg/sql/plan/function/ -count=1` — the package CI aborted early at the
panic — passes end to end.

No production-code change; no CI/workflow change. Fresh CI on the new
head was not awaited.


### Review fix update #1 (2026-10-30, commit 1a96756)

The local review at `9d109f531e` (CHANGES_REQUESTED) reproduced one P2
defect in `pkg/container/arrowbridge/staging_text.go`:
`renderedStageTextBound` estimated a staged Arrow decimal row as
`precision + 3` bytes, which only covers the fixed-point render form. A
declared scale outside the fixed-point domain renders the bounded
scientific form (`<coeff>e<-sf>`), whose exponent bytes the estimate
omitted, and a forged record can carry more coefficient digits than the
declared precision. `MaxOutputRows` then admitted a window of
individually valid rows whose rendered staging payload exceeded the
configured byte budget — the probe admitted two 10^37 rows at scale 1e9
under a 130-byte budget but materialized 148 bytes (146 at scale -1e9) —
leaving the reader's wire-size safeguard to split, copy, and discard the
excess rows.

Fix, scoped to the shared bound helper:

- `pkg/container/arrowbridge/staging_text.go`: `renderedStageTextBound`
now charges decimals the larger of the two reachable render forms over
the physical coefficient span — Decimal128 at most 39 digits (|2^127|),
Decimal256 at most 77 (|2^255|), signed two's-complement storage —
independent of the declared precision. Fixed-point needs a sign, the
digit run zero-padded to the gate-capped scale (<= 76), and the point;
scientific needs a sign, the digits, and `e` plus the
at-most-11-character negated int32-scale text. The resulting
conservative row bounds are 79 bytes (Decimal128) and 90 bytes
(Decimal256).

Regression coverage (`pkg/container/arrowbridge/staging_text_test.go`):

- `TestMaxOutputRowsAccountsScientificStagedText` (new, replicates the
review probe): plain and dictionary-encoded `DECIMAL128(38, +/-1e9)`
rows of coefficient 10^37 under a 130-byte budget admit exactly one row,
and the converted staging window materializes within the budget; a
two-row budget admits both with the encoding-independent 148/146-byte
footprints below the estimate.
- `TestRenderedStageDecimalBoundCoversWorstRenders` (new): the worst
renders the gate can physically emit reach the bound exactly (Decimal256
scientific at scale `math.MaxInt32` = 90 bytes; the shared renderer's
fixed-point ceiling = 79 bytes), and a forged 39-digit Decimal128
coefficient stays inside the bound.
- `TestRenderedStageTextBoundKinds`: pins the 79/90 decimal bounds,
including extreme declared scales;
`TestMaxOutputRowsAccountsRenderedStagedText` row arithmetic updated to
the new bound.

Local verification (Go 1.27.1, repo Makefile CGO flags): the new
regression tests fail on the pre-fix bound with the review's exact
symptom (budget admits 2 rows, expected 1; `arrow-staging-probe.log`
equivalent), and the full `go test ./pkg/container/arrowbridge/
-count=1` passes after the fix. `go test ./pkg/sql/colexec/external/
-count=1` passes except the pre-existing environmental
`TestExternalArrowLoadFromLocalMinIOAndRejectsObjectChange`, whose local
shared MinIO refuses writes because the host Data volume is at 100%
capacity ("minimum free drive threshold"). Production-code change is
confined to the row-size estimate rule; no CI/workflow change. Fresh CI
on the new head was not awaited.

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
XuPeng-SH added a commit that referenced this pull request Nov 9, 2026
…ups (#31419)

## What type of PR is this?

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

## Which issue(s) this PR fixes:

Related performance parent: issue #30518. This scoped candidate does not
close the parent investigation.

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

Grouped Decimal64 SUM/AVG currently builds and probes a local hash table
even when its aggregate state already provides a small dense group-ID
range. For non-DISTINCT Decimal64 fast executors with exactly one state
chunk and 1–256 groups, this change accumulates sums and non-NULL counts
in fixed local arrays, records touched groups, and scatters each touched
result once. DISTINCT keeps its existing path, and other state shapes
keep their general accumulation algorithm. After the DISTINCT dispatch,
a constant-NULL vector returns before either helper is selected; the
general and dense helpers no longer repeat that check. Non-constant
vectors avoid the full constant-NULL predicate at the entry.

Public return types, Decimal256 dispatch, unchecked Decimal128
accumulation and checked finalization semantics, state serialization,
merge behavior, and input ownership are unchanged. No scratch-S
optimization or COUNT DISTINCT repair is included.

The three existing R5 differential regressions are retained, with
empty-input/zero-group cases added to the same suite. They cover
offsets, unmatched rows, constants, NULLs, 255/256/257 groups, multiple
state chunks, growth across the admission boundary, input preservation,
and cancellation of an unchecked near-limit prefix. Existing merge,
legacy wire-format/DISTINCT, rounding and Decimal256 tests supply
adjacent coverage. The canonical AVG numeric BVT now checks grouped
SUM/AVG on both sides of the boundary. Its pre-existing AVG string
expectation is aligned with main's existing scale rule (input scale 2 +
4 = 6); this changes a stale fixture expectation, not product semantics.
Existing metadata expectations are preserved.

## Validation and evidence

### Rebase to main

Rebased onto main `0f6c07639604c40d7ca880cb63d1d282239def08`; the
rebased PR head is `883f4249b462bee3cd2ce0a2c134d2f35dc3b20a`. `git
range-diff` matched the three original non-merge commits, and the
test-cleanup merge and author attribution were retained. On Go 1.27.1
darwin/arm64 with native libraries rebuilt for this source, focused
Decimal64 dense and constant-NULL state tests passed normally and under
`-race`; `git diff --check` passed. The measurements and earlier
qualification below retain their stated historical baselines; no new
reward or MCTS measurement was run. Current-head CI and normal review
remain pending.


### Historical performance evidence — not measurements of this
main-based head

Frozen historical baseline `68e642fdc533e96ed8f83ac44659119ad8be97af`
versus R5 `a87d2290ba566f77298d15e5955d25a01aaf3d4b`:

| Original reward query | Median paired elapsed reduction |
| --- | ---: |
| 1 client, BR/RB | 7.14% |
| 10 clients, BR/RB | 10.29% |

All four paired server-CPU comparisons decreased. Both products were
rebuilt with identical Go 1.27.1/CGo/native inputs, effective build
settings and invocation; all 484 original-input requests passed their
checks (400 timed, 80 warmup, 4 calibration). These are reward-query
results on that historical baseline, not full-MCTS gains, recovered
paper performance, or correctness qualification.

In a separate older kernel microbenchmark, the 8192-row/100-group case
improved by a median 30.98% across three retained pairs. The
1-row/257-group fallback control changed by a median +0.79% elapsed,
with mixed directions; both arms recorded 0 B/op and 0 allocs/op. No
microbenchmark matrix was rerun for this port.

### Exact revision and focused validation

- Base M: `533e95796177d9eacdc909059ccf72b7ddd3ba5f`.
- Head H: `8d74e63cfd61ef64fd3f8eb096df5af5d358e347`. This is the head
bound to the focused evidence below; the pre-rebase test-cleanup merge
was `dde4662aba5234b5616519daead5721413392f31` and the subsequent C
change was `ca7f67b09660ca37891494f061980194c6d52f05`.
- Toolchain: Go 1.27.1, darwin/arm64, `GOEXPERIMENT=simd`, `GOWORK=off`,
readonly modules. CPU native libraries were rebuilt from M and passed
the repository provenance verifier; the same unchanged native artifacts
were used for M/H qualification. Local default Go 1.26.4 was not used.
- Focused normal tests: 42 named aggexec roots, `-count=1`;
selected/run/pass identities checked, no skips.
- Relevant race: 16 named roots, `-race -count=1`; selected/run/pass
identities checked, no skips.
- Real SQL: independently checked
SUM/AVG/NULL/constants/DISTINCT/joins/input preservation across seven
fixtures; widened SUM, explicit CAST clamping with warning 1264, and
recovery after an expected SQL error.
- M and H: changed canonical BVT compared twice on each owned service
with table teardown checked between runs; existing
`sum_decimal256_precision.test` compared successfully. SQL and ISCP
readiness were checked, and both services closed normally. Case/result
bytes were copied unchanged to test-owned paths because this installed
mo-tester rewrites dotted directory names while locating `.result`; it
was not modified.
- Incremental `go vet ./pkg/sql/colexec/aggexec`, `git diff --check`,
and joint semantic/self-review of this exact four-file diff.

These are focused developer checks on macOS, not full package/race
qualification or CI/QA acceptance. Full MCTS and S/S+R5 integration were
not run.

### Open qualification gates

A prior Linux qualification hit an unresolved COUNT DISTINCT native
allocator failure, now tracked in #31732. Full race qualification is
also incomplete. Follow-up baseline controls retained a native failure
while other controls passed, but the first corrupting write and its
relationship to R5 remain unresolved. Baseline failure, identical
DISTINCT source, or non-reproduction in another condition do not
exonerate this candidate. All prior failed evidence is retained; no
restricted memory diagnostic was replayed. A confirmed independent
correctness repair belongs in a separate PR.

### Limited reward confirmation on the newer main baseline

The finite confirmation freezes main at
`baa83f4b96e56ec214f92c68f7b56539b9e0fa45` and measures the GitHub PR
merge tree `26dad7fbc63d8df9bac9a68754ae044f0de969db`, whose parents are
that main and PR head `8d74e63cfd61ef64fd3f8eb096df5af5d358e347`. The
merge tree differs from main only by this PR's four files; the single
runtime source difference is the Decimal64 optimization. The PR head
itself was not rewritten.

| Clients | Order | Main → merge elapsed (s) | Main → merge MO CPU (s) |
Elapsed reduction |
| ---: | :---: | ---: | ---: | ---: |
| 1 | BR | 5.511 → 5.124 | 33.588 → 30.573 | 7.02% |
| 1 | RB | 5.373 → 4.951 | 32.734 → 29.591 | 7.85% |
| 10 | BR | 4.920 → 4.594 | 34.530 → 31.320 | 6.63% |
| 10 | RB | 4.946 → 4.535 | 34.584 → 31.222 | 8.31% |

Median paired elapsed reduction was **7.43%** for 1 client and **7.47%**
for 10 clients; median paired MO CPU reduction was 9.29% and 9.51%,
respectively. All four elapsed and CPU comparisons improved. These two
pairs per client support continued investigation, not a full-MCTS or
paper-performance claim.

Both Linux/amd64 binaries used Go 1.27.1 with identical effective Go/CGo
settings, native libraries, build invocation and binary build metadata;
native inputs were freshly built from the frozen main and passed
provenance verification. The original 30-million-row reward input and
checks were reused. All 484 recorded requests passed: 400 timed, 80
warmup and 4 calibration; eight-table pre/post oracles, resource gates,
service close, evidence readback and exact-owner lock release passed. No
extra samples were selected.

The first preparation attempt stopped at source-tree verification before
any build or reward request because the archive omitted a gitlink. Its
failed evidence was sealed, and the corrected import was independently
checked against the exact main tree before this campaign.

**QA required: yes. R5-specific qualification and normal review remain
required.** The COUNT DISTINCT issue is tracked separately in #31732 per
the requester's decision and is not an additional merge prerequisite;
its root cause and relation to R5 remain unresolved. Normal review may
still raise any concrete candidate-related defect. Exact-head CI,
applicable qualification, performance disposition and normal review
remain required; no full-MCTS benefit is claimed.



### Test-cleanup merge and performance disposition

The #5 change only modifies `sum_decimal_dense_test.go`;
`sum_decimal_fast.go` is unchanged from `8d74e63c…`. Before the merge,
the exact #5 test-file blob was applied as a Go overlay on the clean
parent using Go 1.27.1 on darwin/arm64 with verified native provenance.
The three dense regression roots passed normally and under `-race` (61
test pass events per run, no skips); all 12 benchmark cases completed a
one-iteration cleanup smoke run. After merge, the test-file Git blob
equals the validated overlay. This is source-equivalence validation; the
binaries were built before the merge commit and are not claimed to
contain its VCS identity. Current-head CI remains the authoritative CI
gate.

Historical local controls reported constant-NULL +5.19% and sequential
groups +0.88% for PR `8d74e63c…` locally merged with main `802376360c…`.
The original raw comparison and complete build identity were not
independently verified; these remain historical signals, not
current-head measurements.

### Constant-NULL follow-up C: validation and performance disposition

The pre-rebase commit `ca7f67b09660ca37891494f061980194c6d52f05` adds
only the early non-DISTINCT constant-NULL dispatch and its
state-transition regression. Its product source is byte-identical to the
Ubuntu C overlay; the committed regression test is byte-identical to the
test portion of that overlay fixture. The Ubuntu measurements used a
common `baa83f4b…` source base with B/R/C product overlays, not the
exact final PR commit or a release binary. B's Decimal64 SUM source
matches the original branch base; R's matches `dde4662a…`. Go
1.27.1/linux-amd64, identical CGo/native, `GOAMD64=v3` and
`GOEXPERIMENT=simd` were used. Six interleaved rounds were
pre-specified; all 108 case/version samples are retained.

| Control | R vs B elapsed | C vs R elapsed |
| --- | ---: | ---: |
| Constant NULL, dense | +5.92% [+5.49%, +6.36%] | -17.26% [-17.64%,
-16.87%] |
| Constant NULL, fallback | +5.70% [+5.19%, +6.20%] | -17.08% [-17.71%,
-16.44%] |
| Sequential groups | -36.03% [-38.07%, -33.92%] | -0.06% [-4.40%,
+4.47%] |

Intervals are paired, two-sided 95% t intervals. Each operation
processes 8,192 rows in 32 BatchFill calls; the dense constant-NULL B/R
medians were approximately 112.0/118.65 ns per operation. Production
frequency and SQL-level cost are unknown. The two NULL shapes and three
other controls met the pre-specified C criteria; **sequential groups
remain INCONCLUSIVE**, with an upper bound above the original +1%
criterion. The requester accepts this limited uncertainty for normal
review given the measured NULL benefit, other controls and bounded code
inspection; this does not imply maintainer acceptance, a full
performance pass, or a claim that C cannot regress in a real workload.
No favorable samples were added or excluded.

The final C worktree content was tested on Go 1.27.1/darwin-arm64 with
verified native provenance: focused SUM/AVG and dense/state-transition
normal and `-race` runs each recorded 246 pass events including
subtests, with zero skips. Incremental vet, lint, gofmt and `git diff
--check` passed. Tests ran before committing and their source and test
file hashes were verified equal to `ca7f67b…`; this is content-bound
evidence, not an exact-commit VCS-stamped test binary. Earlier SQL/BVT
evidence remains bound to `8d74e63c…`; no new real SQL or reward
execution was performed for C. Final-head CI and normal review remain
required. Full MCTS and S/S+R5 were not run.

The old `dde4662a…` CI included an HNSW vector BVT failure, a canceled
SCA job and coverage blocked by a missing producer; its cause and
relationship to this PR are not determined. New-head CI must be assessed
independently.

## Independent local qualification and open regressions

The PR source `8d74e63cfd` was merged locally with MatrixOne main
`802376360c`; these checks do not resolve the historical COUNT DISTINCT
allocator failure tracked in #31732. The owner aggregate and group
suites passed under `-race` on that merge. Two allocation-sensitive
aggregate tests were skipped by their existing race guards and passed
separately without instrumentation.

A full aggregate AddressSanitizer run passed on clean main and the
main-merged PR with the test-only cleanup in [the follow-up
PR](VioletQwQ-0#5). Three
allocation-count tests were run separately without instrumentation
because sanitizer bookkeeping changes those counts. The prebuilt native
libraries were not rebuilt with sanitizer instrumentation. Repeated
COUNT DISTINCT tests and the selected DISTINCT sanitizer suite did not
reproduce a corrupting write; the historical failure remains unresolved.
The original fixed-width commands, binary bindings and logs are retained
locally, but have not been published as attachments.

The matched local 22-case control matrix for the PR found slower
signals. A separate six-pair, one-second-per-case confirmation measured
constant-NULL batches at **+5.19%** (95% interval +4.99% to +5.31%) and
sequential groups at **+0.88%** (+0.14% to +1.21%) versus clean main.
Each operation uses 8,192 rows in 256-row calls. Component wins in other
shapes do not waive these regressions.

A private, dense-only NULL correction improved the constant-NULL control
by 8.39% but still showed sequential +0.89% and endpoint +0.36% in
separate confirmations. Its independent SF10 Q1/Q18 comparison measured
Q1 −2.82% (95% interval −5.04% to −0.30%) and Q18 +0.69% (−2.15% to
+4.77%). These measurements are for the corrected local revision, not
the current PR head. The correction has not passed the no-regression
gate and has not been added to the PR.

The local TPC-H comparison used eight physical cores, a 16 GiB CN cache
and a 32 GiB whole-application budget. All 12 scored arms passed the
recorded memory and host gates; the first cold execution was excluded.
The worker executed and drained queries without verifying inputs,
schemas, rows or results or computing checksums. SF100 was not run
locally.

Mergify's previous [branch-update
check](https://github.com/matrixorigin/matrixone/runs/122066626032)
reported that it needs authorization to modify the fork's head branch.
The test-only cleanup in [follow-up
#5](VioletQwQ-0#5) is now merged into
this branch; its merge commit is
`dde4662aba5234b5616519daead5721413392f31`. Current-head CI and normal
review remain required; the allocator report is tracked independently in
#31732.



### Further local dispatch experiment — rejected

A general-path-first revision (`6db8b143f0`, not on this PR) was
compared directly with the main-merged PR source plus the separate test
cleanup (`5bba376c9e`). The 22-case owner matrix found no slower signal
relative to the PR and improved its constant-NULL control by 13.02%.
That did not establish end-to-end acceptance: the full local SF10 Q1–Q22
comparison found Q8 +3.22% (95% interval +1.98% to +4.76%) and Q21
+1.94% (+0.41% to +2.79%). A separate six-pair Q8/Q21 run with nine warm
calls per arm independently confirmed **Q21 +1.80%** (+1.01% to +2.46%).
This candidate is rejected.

Q8's longer standalone-context check had a −1.03% paired median with an
interval from −3.21% to +3.98%; it does not reproduce or invalidate the
full-suite Q8 result because query warm-up order differs. A full-prefix
Q8 repeat was stopped after the independent Q21 regression already
rejected the candidate; its partial timings are not used as acceptance
evidence. In separate warm Q21 CPU profiles, both binaries spent the
largest sample shares in the same hash-probe and decompression
functions. Scan filtering accounted for 3.39% of baseline samples and
3.78% of candidate samples; its function entry moved by 32 bytes
relative to a 64-byte instruction-cache line even though its source did
not change. Q21 uses COUNT(*) rather than SUM. These observations are
consistent with an indirect code-placement or runtime effect but do not
identify a proven cause; each profile is a separate sampled run. All
scored arms ran locally with the cold execution excluded and without
input, schema, row or result verification.

---------

Co-authored-by: bRong Njam <[email protected]>
Co-authored-by: XuPeng-SH <[email protected]>
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.

More documents are needed in Github REPO

2 participants