Skip to content

fix: return NULL for POWER EXP and COT arithmetic failures - #28375

Merged
XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
Lundomn:codex/issue-28137-null-followup
Sep 8, 2026
Merged

XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
Lundomn:codex/issue-28137-null-followup

Conversation

@Lundomn

@Lundomn Lundomn commented Sep 8, 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:

Fixes #28137. Follow-up to merged PR #28155.

What this PR does / why we need it:

Implement the row-local NULL behavior requested by #28137. POWER(-1,0.5), POWER(0,-1), EXP(1000), and COT(0) now return NULL instead of aborting the statement. Valid rows after an invalid row continue to be evaluated. Existing finite calculations, underflow-to-zero, input NULLs, and selection masks are preserved through the existing null-on-error vector helpers.

Mark POWER/POW, EXP, and COT as potentially nullable even with NOT NULL arguments. This keeps planner deductions, IS NULL predicates, and CTAS column nullability consistent with the new results.

Intentional SQL behavior change

This supersedes #28155's error-preserving contract to fulfill the issue's requested NULL semantics. It is an intentional MatrixOne behavior change, not a claim of restoring MySQL compatibility: MySQL 8.4 routes POW/EXP non-finite results and COT(0) to errors (function implementations, overflow check). Maintainer review should explicitly consider this divergence.

  • Aggregates such as SUM/COUNT ignore the resulting NULLs instead of failing the query.
  • INSERT SELECT and UPDATE can store these results in nullable columns.
  • NOT NULL constraints still reject them; a rejected mixed-row INSERT leaves no partial rows.
  • No new warning mechanism is added. The issue permits optional warnings; these arithmetic failures become NULL without emitting a new warning.
  • Other functions, conversion errors, and schema constraints retain their existing behavior.

Validation

Base: b2f0f3fe69b23cde495c59d226c647aba555cfdc (fresh origin/main when the branch was created).

  • Red/green: 10 arithmetic subcases failed with the original range errors before the helper changes; all passed afterward. Three nullable-deduction subcases independently failed before the planner fix.
  • Focused POWER/EXP/COT invalid-result and selection-mask tests passed; the full pkg/sql/plan/function suite passed after the final production change using .agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=240s ./pkg/sql/plan/function.
  • make build-with-prebuilt-native passed on macOS arm64 / Go 1.27.0.
  • Isolated native single-CN mo-tester, normal comparison mode (nometa ignore pprof, equivalent to -n -g -o -p): POWER 101, EXP 39, TRIG 133, general math 42, builtin 256, decimal 688: 1,259/1,259 SQL statements passed. All five changed cases also passed a second run on the same instance.
  • BVT covers constant folding, decimal/integer casts, mixed vectors, aggregate/filter behavior, nullable INSERT/UPDATE, NOT NULL rejection and atomicity, prepared-statement reuse, NOT NULL source columns, IS NULL predicates, and CTAS metadata. The new tables are dropped and their absence is asserted.
  • Generated result drafts were reviewed against explicit expected rows; unrelated formatting/metadata drift was removed before normal comparison runs. Existing affected golden results were updated.
  • git diff --check passed.

Self-review: R2 SQL result/metadata contract change; existing helpers and fixtures reused, no new shared state, resource ownership, persistence format, or distributed protocol. Focused design-document exemption applies; the contract and tradeoffs are recorded above. No remaining implementation or validation blocker found. MySQL source evidence is cited; no MySQL server execution is claimed.

@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 →

@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.

Deep review of exact head 7b14c6c against b2f0f3f: inspected all 13 changed files/hunks and traced the shared vector helpers and numeric kernels. No verified implementation blocker found.

This approval explicitly accepts the PR's stated MatrixOne row-local NULL contract for existing POWER/EXP/COT arithmetic failures; it is not a MySQL-compatibility endorsement. In particular, MySQL documents COT(0) as an out-of-range error (https://dev.mysql.com/doc/refman/8.4/en/mathematical-functions.html#function_cot). The issue and previous merged PR had conflicting expectations; the current PR clearly discloses and tests the intentional behavior change, including aggregate NULL elision, nullable DML, NOT NULL rejection and no new warnings.

Checked constant/constant, mixed constant/vector and vector/vector helper branches, input NULL propagation, partial/all-row masks, invalid-row continuation, POWER NaN/Inf rejection, positive/negative zero, EXP overflow versus underflow, POW/POWER aliasing, and DeduceNotNullable with NOT NULL inputs. Cast evaluation remains outside the scalar callback, so this does not blanket-swallow conversion or schema errors. Existing momath kernels are unchanged: this is conversion of their reported arithmetic failures, not a general redesign of special-value or COT numerical accuracy behavior.

The finite path retains the same numeric callback and linear vector traversal with no new shared state or resource lifecycle; invalid rows now update the result null bitmap and continue. Reviewed BVT expected rows for folding, mixed rows, aggregates, filters, nullable INSERT/UPDATE, failed mixed-row NOT NULL INSERT atomicity, prepared reuse, IS NULL on NOT NULL sources and CTAS metadata. Exact-head CI run 34186089667 is successful; its logs include the changed func_math_power case in the PROXY BVT job. The PR's red/green, full function-suite and 1,259-statement native validation are reused as author-reported evidence, not claimed as independently rerun here.

Non-blocking: carry the intentional compatibility change into release notes/QA acceptance so error-dependent ETL clients are not surprised. If invalid-heavy analytical workloads matter, a later optimization can avoid allocating formatted error objects that these helpers immediately discard; no finite-path regression was identified in this change.

@mergify mergify Bot added the queued label Sep 8, 2026
@mergify

mergify Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-09-08 05:04 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🟠 Checks running · in-place
  • 🚫 Left the queue — 2026-09-08 05:19 UTC · at 9fc1e631faa5b5a3bafec2d21e9810271e12648c

This pull request spent 15 minutes 36 seconds in the queue, with no time running CI.

Reason

Pull request #28375 has been merged manually at 80d214b

Hint

You were too fast!

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

  • Requeue this pull request

@XuPeng-SH
XuPeng-SH merged commit 80d214b into matrixorigin:main Sep 8, 2026
19 of 21 checks passed
@mergify mergify Bot removed the queued label Sep 8, 2026
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…gin#28375)

## What type of PR is this?

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

## Which issue(s) this PR fixes:

Fixes matrixorigin#28137. Follow-up to merged PR matrixorigin#28155.

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

Implement the row-local NULL behavior requested by matrixorigin#28137.
`POWER(-1,0.5)`, `POWER(0,-1)`, `EXP(1000)`, and `COT(0)` now return
NULL instead of aborting the statement. Valid rows after an invalid row
continue to be evaluated. Existing finite calculations,
underflow-to-zero, input NULLs, and selection masks are preserved
through the existing null-on-error vector helpers.

Mark POWER/POW, EXP, and COT as potentially nullable even with NOT NULL
arguments. This keeps planner deductions, IS NULL predicates, and CTAS
column nullability consistent with the new results.

### Intentional SQL behavior change

This supersedes matrixorigin#28155's error-preserving contract to fulfill the
issue's requested NULL semantics. It is an intentional MatrixOne
behavior change, **not a claim of restoring MySQL compatibility**: MySQL
8.4 routes POW/EXP non-finite results and COT(0) to errors ([function
implementations](https://github.com/mysql/mysql-server/blob/8.4/sql/item_func.cc#L2867-L2953),
[overflow
check](https://github.com/mysql/mysql-server/blob/8.4/sql/item_func.h#L602-L604)).
Maintainer review should explicitly consider this divergence.

- Aggregates such as SUM/COUNT ignore the resulting NULLs instead of
failing the query.
- INSERT SELECT and UPDATE can store these results in nullable columns.
- NOT NULL constraints still reject them; a rejected mixed-row INSERT
leaves no partial rows.
- No new warning mechanism is added. The issue permits optional
warnings; these arithmetic failures become NULL without emitting a new
warning.
- Other functions, conversion errors, and schema constraints retain
their existing behavior.

### Validation

Base: `b2f0f3fe69b23cde495c59d226c647aba555cfdc` (fresh origin/main when
the branch was created).

- Red/green: 10 arithmetic subcases failed with the original range
errors before the helper changes; all passed afterward. Three
nullable-deduction subcases independently failed before the planner fix.
- Focused POWER/EXP/COT invalid-result and selection-mask tests passed;
the full `pkg/sql/plan/function` suite passed after the final production
change using `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1
-timeout=240s ./pkg/sql/plan/function`.
- `make build-with-prebuilt-native` passed on macOS arm64 / Go 1.27.0.
- Isolated native single-CN mo-tester, normal comparison mode (`nometa
ignore pprof`, equivalent to `-n -g -o -p`): POWER 101, EXP 39, TRIG
133, general math 42, builtin 256, decimal 688: **1,259/1,259 SQL
statements passed**. All five changed cases also passed a second run on
the same instance.
- BVT covers constant folding, decimal/integer casts, mixed vectors,
aggregate/filter behavior, nullable INSERT/UPDATE, NOT NULL rejection
and atomicity, prepared-statement reuse, NOT NULL source columns, IS
NULL predicates, and CTAS metadata. The new tables are dropped and their
absence is asserted.
- Generated result drafts were reviewed against explicit expected rows;
unrelated formatting/metadata drift was removed before normal comparison
runs. Existing affected golden results were updated.
- `git diff --check` passed.

Self-review: R2 SQL result/metadata contract change; existing helpers
and fixtures reused, no new shared state, resource ownership,
persistence format, or distributed protocol. Focused design-document
exemption applies; the contract and tradeoffs are recorded above. No
remaining implementation or validation blocker found. MySQL source
evidence is cited; no MySQL server execution is claimed.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…gin#28375)

## What type of PR is this?

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

## Which issue(s) this PR fixes:

Fixes matrixorigin#28137. Follow-up to merged PR matrixorigin#28155.

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

Implement the row-local NULL behavior requested by matrixorigin#28137.
`POWER(-1,0.5)`, `POWER(0,-1)`, `EXP(1000)`, and `COT(0)` now return
NULL instead of aborting the statement. Valid rows after an invalid row
continue to be evaluated. Existing finite calculations,
underflow-to-zero, input NULLs, and selection masks are preserved
through the existing null-on-error vector helpers.

Mark POWER/POW, EXP, and COT as potentially nullable even with NOT NULL
arguments. This keeps planner deductions, IS NULL predicates, and CTAS
column nullability consistent with the new results.

### Intentional SQL behavior change

This supersedes matrixorigin#28155's error-preserving contract to fulfill the
issue's requested NULL semantics. It is an intentional MatrixOne
behavior change, **not a claim of restoring MySQL compatibility**: MySQL
8.4 routes POW/EXP non-finite results and COT(0) to errors ([function
implementations](https://github.com/mysql/mysql-server/blob/8.4/sql/item_func.cc#L2867-L2953),
[overflow
check](https://github.com/mysql/mysql-server/blob/8.4/sql/item_func.h#L602-L604)).
Maintainer review should explicitly consider this divergence.

- Aggregates such as SUM/COUNT ignore the resulting NULLs instead of
failing the query.
- INSERT SELECT and UPDATE can store these results in nullable columns.
- NOT NULL constraints still reject them; a rejected mixed-row INSERT
leaves no partial rows.
- No new warning mechanism is added. The issue permits optional
warnings; these arithmetic failures become NULL without emitting a new
warning.
- Other functions, conversion errors, and schema constraints retain
their existing behavior.

### Validation

Base: `b2f0f3fe69b23cde495c59d226c647aba555cfdc` (fresh origin/main when
the branch was created).

- Red/green: 10 arithmetic subcases failed with the original range
errors before the helper changes; all passed afterward. Three
nullable-deduction subcases independently failed before the planner fix.
- Focused POWER/EXP/COT invalid-result and selection-mask tests passed;
the full `pkg/sql/plan/function` suite passed after the final production
change using `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1
-timeout=240s ./pkg/sql/plan/function`.
- `make build-with-prebuilt-native` passed on macOS arm64 / Go 1.27.0.
- Isolated native single-CN mo-tester, normal comparison mode (`nometa
ignore pprof`, equivalent to `-n -g -o -p`): POWER 101, EXP 39, TRIG
133, general math 42, builtin 256, decimal 688: **1,259/1,259 SQL
statements passed**. All five changed cases also passed a second run on
the same instance.
- BVT covers constant folding, decimal/integer casts, mixed vectors,
aggregate/filter behavior, nullable INSERT/UPDATE, NOT NULL rejection
and atomicity, prepared-statement reuse, NOT NULL source columns, IS
NULL predicates, and CTAS metadata. The new tables are dropped and their
absence is asserted.
- Generated result drafts were reviewed against explicit expected rows;
unrelated formatting/metadata drift was removed before normal comparison
runs. Existing affected golden results were updated.
- `git diff --check` passed.

Self-review: R2 SQL result/metadata contract change; existing helpers
and fixtures reused, no new shared state, resource ownership,
persistence format, or distributed protocol. Focused design-document
exemption applies; the contract and tradeoffs are recorded above. No
remaining implementation or validation blocker found. MySQL source
evidence is cited; no MySQL server execution is claimed.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…gin#28375)

## What type of PR is this?

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

## Which issue(s) this PR fixes:

Fixes matrixorigin#28137. Follow-up to merged PR matrixorigin#28155.

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

Implement the row-local NULL behavior requested by matrixorigin#28137.
`POWER(-1,0.5)`, `POWER(0,-1)`, `EXP(1000)`, and `COT(0)` now return
NULL instead of aborting the statement. Valid rows after an invalid row
continue to be evaluated. Existing finite calculations,
underflow-to-zero, input NULLs, and selection masks are preserved
through the existing null-on-error vector helpers.

Mark POWER/POW, EXP, and COT as potentially nullable even with NOT NULL
arguments. This keeps planner deductions, IS NULL predicates, and CTAS
column nullability consistent with the new results.

### Intentional SQL behavior change

This supersedes matrixorigin#28155's error-preserving contract to fulfill the
issue's requested NULL semantics. It is an intentional MatrixOne
behavior change, **not a claim of restoring MySQL compatibility**: MySQL
8.4 routes POW/EXP non-finite results and COT(0) to errors ([function
implementations](https://github.com/mysql/mysql-server/blob/8.4/sql/item_func.cc#L2867-L2953),
[overflow
check](https://github.com/mysql/mysql-server/blob/8.4/sql/item_func.h#L602-L604)).
Maintainer review should explicitly consider this divergence.

- Aggregates such as SUM/COUNT ignore the resulting NULLs instead of
failing the query.
- INSERT SELECT and UPDATE can store these results in nullable columns.
- NOT NULL constraints still reject them; a rejected mixed-row INSERT
leaves no partial rows.
- No new warning mechanism is added. The issue permits optional
warnings; these arithmetic failures become NULL without emitting a new
warning.
- Other functions, conversion errors, and schema constraints retain
their existing behavior.

### Validation

Base: `b2f0f3fe69b23cde495c59d226c647aba555cfdc` (fresh origin/main when
the branch was created).

- Red/green: 10 arithmetic subcases failed with the original range
errors before the helper changes; all passed afterward. Three
nullable-deduction subcases independently failed before the planner fix.
- Focused POWER/EXP/COT invalid-result and selection-mask tests passed;
the full `pkg/sql/plan/function` suite passed after the final production
change using `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1
-timeout=240s ./pkg/sql/plan/function`.
- `make build-with-prebuilt-native` passed on macOS arm64 / Go 1.27.0.
- Isolated native single-CN mo-tester, normal comparison mode (`nometa
ignore pprof`, equivalent to `-n -g -o -p`): POWER 101, EXP 39, TRIG
133, general math 42, builtin 256, decimal 688: **1,259/1,259 SQL
statements passed**. All five changed cases also passed a second run on
the same instance.
- BVT covers constant folding, decimal/integer casts, mixed vectors,
aggregate/filter behavior, nullable INSERT/UPDATE, NOT NULL rejection
and atomicity, prepared-statement reuse, NOT NULL source columns, IS
NULL predicates, and CTAS metadata. The new tables are dropped and their
absence is asserted.
- Generated result drafts were reviewed against explicit expected rows;
unrelated formatting/metadata drift was removed before normal comparison
runs. Existing affected golden results were updated.
- `git diff --check` passed.

Self-review: R2 SQL result/metadata contract change; existing helpers
and fixtures reused, no new shared state, resource ownership,
persistence format, or distributed protocol. Focused design-document
exemption applies; the contract and tradeoffs are recorded above. No
remaining implementation or validation blocker found. MySQL source
evidence is cited; no MySQL server execution is claimed.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
aptend added a commit to aptend/matrixone that referenced this pull request Nov 18, 2026
POW/POWER with a finite negative base and a finite non-integer exponent is undefined in the real domain; reject it with the typed DOUBLE out-of-range error (1690/22003) instead of a silent row-local NULL. Empty-batch, masked/selected rows, NULL inputs, integer exponents and the matrixorigin#28375 row-local NULL semantics (overflow/NaN-input, EXP/COT) are preserved; the func_math_power BVT oracle is corrected accordingly.

Fixes matrixorigin#31155
aptend added a commit to aptend/matrixone that referenced this pull request Nov 18, 2026
POW/POWER with a finite negative base and a finite non-integer exponent is undefined in the real domain; reject it with the typed DOUBLE out-of-range error (1690/22003) instead of a silent row-local NULL. Empty-batch, masked/selected rows, NULL inputs, integer exponents and the matrixorigin#28375 row-local NULL semantics (overflow/NaN-input, EXP/COT) are preserved; the func_math_power BVT oracle is corrected accordingly.

Fixes matrixorigin#31155
XuPeng-SH pushed a commit that referenced this pull request Nov 19, 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:

issue #31155

Fixes #31155

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

POW/POWER with a finite negative base and a finite non-integer exponent
is mathematically undefined in the real domain, but MatrixOne silently
returned a row-local NULL. This PR makes the Power operator reject such
arguments with the typed DOUBLE out-of-range error (MySQL 1690, SQLSTATE
22003, `data out of range: data type float64, DOUBLE value is out of
range in 'pow(-2,0.5)'`), keeping the #28375 row-local NULL semantics
untouched for overflow/NaN-input (EXP/COT) cases.

It also carries a CI fix found by this PR's own required `-race` UT job:
`gc/v3.buildTableExistenceMap` read each table catalog entry's MVCC
chain delete timestamp via `GetDeleteAtLocked` without the entry lock,
racing `DBEntry.DropTableEntryByID` (entry write lock ->
`DropEntryLocked` -> `DeleteLocked` -> `InsertLocked`), reported three
times in
`TestDataBranchDiffAcrossCheckpointGCAndRestart/gc_checkpoint_restart`.
The GC reader now takes the same entry's read lock around the delete-at
snapshot; no IO, callback, or extra lock inside the critical section, no
live-table protection change.

The branch now also preserves CI failure observability for the UT-shard
cleanup deadline that still fails this job's `pkg/tests/issues` run on
both known CI attempts (its underlying wait owner is not determined by
any retained artifact): a bounded test-only diagnostic in the shared
fixture, added to the failing error path only. It changes no product
code, budget, assertion, expected values, or cleanup semantics and does
not claim to fix that cleanup failure or any 31401 behavior — it records
the cleanup SQL's start/end/elapsed/error plus a bounded 16KiB goroutine
snapshot before the original assert so a future CI occurrence retains
additional evidence; the bounded snapshot may truncate or miss the
actual wait owner.

Scope (5 Power files + 2 GC files + 3 test-only CI files):
- `pkg/sql/plan/function/func_binary.go`: Power evaluates rows first and
rejects domain-invalid arguments with the typed error; empty-batch and
masked/selected-row safety preserved, NULL inputs stay NULL, integer
exponents valid, #28375 semantics unchanged.
- `pkg/sql/plan/function/func_binary_test.go`: focused unit coverage for
the typed rejection and preserved semantics.
- `test/distributed/cases/function/func_math_power.test` and
`func_math_power.result`: BVT coverage incl. the prepared-statement
overflow-NULL statement before the domain cases, with canonical
out-of-range goldens.
- `pkg/sql/compile/tp_allocation_reuse_test.go`: real prepared-TP
consumer regression - one-constructed `power(v-2, 0.5)` projection on
the reused TableScan->Filter->Projection prepared pipeline; the typed
moerr reaches the caller, the failed batch is never published, the SAME
compiled executor recovers exact `0/1` results.
- `pkg/vm/engine/tae/db/gc/v3/exec_v1.go`: `buildTableExistenceMap`
holds the table entry's RLock across `GetDeleteAtLocked`/`GetID`.
- `pkg/vm/engine/tae/db/gc/v3/executor_test.go`: owner regression
`TestBuildTableExistenceMapConcurrentCatalogDrop` - a real mock-factory
catalog and txn manager; 200 concurrent `buildTableExistenceMap`
snapshots against 12 serial real `DBEntry.DropTableEntryByID` drops.
Every transaction the test starts is registered in its mock txn store
(DB entry, table entries, and each dropped entry, exactly like the
catalog mock), finalized with explicit `Commit(ctx)`/`Rollback(ctx)` on
every path, and snapshots taken under `ownedMu` are released before
fatal assertions so `FailNow` cannot deadlock the cleanup net.
- `pkg/tests/issues/issue_31401_scalar_test.go` (8th file, test-only):
inside the shared `cleanupSQL` helper, when the cleanup statement
already returned an error, one bounded 16KiB `runtime.Stack` snapshot
plus the statement's start/end/elapsed/error/cleanup-ctx error are
logged before the unchanged `assert.NoErrorf`; the successful result,
both original cleanup budgets, the returned error, and the guarded
deferred cleanup ordering retain their existing semantics. This is
measurement-only: it does not alter or interpret any result, and no
cleanup failure is claimed fixed.

- `pkg/objectio/arena_pool_test.go`: replace the burst-reaping test's
scheduler-sensitive real-time warmup with controlled `testing/synctest`
normal and deliberately delayed first-fire schedules. The actual pool
reaper still runs; final synchronization includes buffer frees after the
pool unlock. Snapshots release the pool lock before fatal assertions,
and borrowed arenas and bubble-owned timers have explicit cleanup.
- `pkg/embed/cdc_control_status_test.go`: bound only the initial
idempotent, read-only `GetClusterState` fixture setup to three attempts
on the same two-minute context, retrying only `errors.Is(err,
dragonboat.ErrTimeout)`. Other errors, persistent timeouts and
cancellation still fail; claims, heartbeats, writes and their assertions
are unchanged. Seven deterministic cases check request bounds, error
identity, context identity and cancellation. The HAKeeper stall's
underlying cause remains UNKNOWN.

Verification performed:
- Focused owning unit suite for the Power change; the full TP-reuse trio
`TestTPReusePowerProjectionDomainErrorRecovery|TestTPReusableOperatorsAllocationScope|TestTPReusablePipelineQueries`
in the CI UT-matching mode via the tree's `mo-cgo-test` wrapper:
`CGO_ENABLED=1 .agents/skills/mo-dev/scripts/mo-cgo-test -race -short
-tags matrixone_test -count=1 -v -timeout=10m -run
'^(TestTPReusePowerProjectionDomainErrorRecovery|TestTPReusableOperatorsAllocationScope|TestTPReusablePipelineQueries)$'
./pkg/sql/compile` => all PASS, 0 data-race reports, process returncode
0.
- The GC owner regression in the fatal-cleanup-hardened form, same
matching mode: `CGO_ENABLED=1 .agents/skills/mo-dev/scripts/mo-cgo-test
-race -short -tags matrixone_test -count=1 -v -timeout=10m -run
'^TestBuildTableExistenceMapConcurrentCatalogDrop$'
./pkg/vm/engine/tae/db/gc/v3` => one RUN / one PASS, 0 data-race
reports, process returncode 0, source/native SHAs unchanged around the
run (receipts retained).
- The exact CI-failed GC target with the accepted fix at its recorded
validation base (reused because its executed code paths and native
inputs are unchanged): `CGO_ENABLED=1
.agents/skills/mo-dev/scripts/mo-cgo-test -race -short -tags
matrixone_test -count=1 -v -run
'^TestDataBranchDiffAcrossCheckpointGCAndRestart$/^gc_checkpoint_restart$'
./pkg/embed` => PASS (`ok github.com/matrixorigin/matrixone/pkg/embed`),
0 data-race reports.
- This batch's retained local matching run of
`^TestIssue31401ScalarRefreshProgress$` used `-race -short -tags
matrixone_test -count=1 -v`: process RC0, 17 RUN / 17 PASS including the
parent and all 16 modes. It was a local non-reproduction at the recorded
validation revision, reused for unchanged executed paths; the newly
added diagnostic's error branch was not exercised by that passing run.
Another PR's local probe is not counted as an additional own-batch pass.
The original CI failure's wait owner remains UNKNOWN, and the diagnostic
does not fix or explain it. The retained CI artifacts remain truncated,
with omitted stderr/link/scratch evidence.
- The branch was linearly rebased onto the current upstream main
(`035af9968069 fix(frontend): handle missing subscriber accounts in SHOW
PUBLICATIONS (#32901)`) with no merge commits; the eight published files
remain byte-identical to their accepted blobs; the two additional
changes are the arena and CDC test fixtures described above.
- Current official test-aware static-analysis closure at main
`035af996806917b23d9428695e0295b65cb16356`: **170 required packages, all
covered**. The previous 169-package closure comprised 107
identity-qualified reused analyses, 4 owner receipts and 58 fresh
package checks. Adding the arena test selects `pkg/objectio`; changing
the CDC test invalidates the previous `pkg/embed` proof. The final
closure therefore has 168 still-valid analyses plus fresh pinned
dual-checker passes for `./pkg/objectio` and `./pkg/embed` (both
original process RC0, `0 issues.`). The official inventory and selector
were refreshed for the actual test imports; native/configuration
identities and unchanged analysis inputs qualify the reused evidence. No
repository-wide lint fallback, disabled checker or suppression was used.

Executed current missing-package command (58 explicit packages, original
RC0 for the fatal two-checker make target):

  ```sh
CGO_ENABLED=1 make static-check-selected
STATIC_CHECK_PACKAGES='./cmd/mo-inspect ./cmd/mo-service ./cmd/mo-tool
./pkg/backup ./pkg/bootstrap ./pkg/bootstrap/versions/v1_2_0
./pkg/bootstrap/versions/v2_0_0 ./pkg/bootstrap/versions/v2_0_1
./pkg/bootstrap/versions/v2_0_2 ./pkg/bootstrap/versions/v2_2_0
./pkg/bootstrap/versions/v3_0_0 ./pkg/bootstrap/versions/v4_0_0
./pkg/bootstrap/versions/v4_0_7 ./pkg/cnservice ./pkg/datasync
./pkg/embed ./pkg/frontend ./pkg/frontend/test/mock_moserver
./pkg/fulltext/plugin/iscp ./pkg/fulltext2/plugin/iscp
./pkg/indexplugin/iscp ./pkg/iscp ./pkg/proxy ./pkg/publication
./pkg/sql/colexec/apply ./pkg/sql/colexec/mergeblock
./pkg/sql/colexec/multi_update ./pkg/sql/colexec/preinsert
./pkg/sql/colexec/productl2 ./pkg/sql/colexec/table_clone
./pkg/sql/colexec/table_function ./pkg/tests/arrowload ./pkg/tests/dml
./pkg/tests/issues/internal/joinspill ./pkg/tests/issues/isolated
./pkg/tests/partition ./pkg/tests/service ./pkg/tests/shard
./pkg/tests/sqlintegration ./pkg/tests/sqlintegration/multicn
./pkg/tests/testutils ./pkg/tests/txn ./pkg/tests/upgrade
./pkg/tnservice ./pkg/txn/storage/tae ./pkg/util/status ./pkg/util/test
./pkg/vectorindex/hnsw/plugin/iscp ./pkg/vectorindex/ivfflat/plugin/iscp
./pkg/vm/engine/disttae ./pkg/vm/engine/tae/db
./pkg/vm/engine/tae/db/test ./pkg/vm/engine/tae/db/test/compatibility
./pkg/vm/engine/tae/db/testutil ./pkg/vm/engine/tae/rpc
./pkg/vm/engine/tae/testutils/config ./pkg/vm/engine/test
./pkg/vm/engine/test/testutil'
  ```

The separate current issues-owner command was `CGO_ENABLED=1 make
static-check-selected STATIC_CHECK_PACKAGES=./pkg/tests/issues`,
original RC0. Earlier valid function/compile/GC owner checks and the 107
unaffected analyses were reused only after source/native/config and
dependency closure checks; no Go tests were repeated for this
diagnostic-only timestamp move.

Additional executed missing-owner checks (each original process RC0,
repository-pinned molint and golangci-lint):

```sh
CGO_ENABLED=1 make static-check-selected STATIC_CHECK_PACKAGES=./pkg/objectio
CGO_ENABLED=1 make static-check-selected STATIC_CHECK_PACKAGES=./pkg/embed
```

Additional matching verification:
- Arena burst parent and its two controlled-clock schedules:
`CGO_ENABLED=1 .agents/skills/mo-dev/scripts/mo-cgo-test -mod=readonly
-count=1 -short -v -tags matrixone_test -covermode=set -run
'^TestArenaBurstReleasedWhileStillActive$' ./pkg/objectio` => original
process RC0, 3 RUN/PASS; adjacent timer-contract tests also passed once.
The earlier failing local variants remain recorded.
- `CGO_ENABLED=1 .agents/skills/mo-dev/scripts/mo-cgo-test -race -short
-tags matrixone_test -count=1 -v -timeout=15m -run
'^(TestCDCSourceGenerationGuardAcrossCN|TestCDCInitialClusterStateReadinessBounds)$'
./pkg/embed` => original process RC0, 14 RUN including seven
deterministic helper cases and the real cross-CN parent/subtests. An
initial import-path setup failure had RC1 and zero selected tests; it
was corrected before this successful run. These local passes do not
establish CI success or explain the HAKeeper stall.

<details>
<summary>Current official test-aware required package selection (170
literal packages; selection, not a claim that all 170 were
rerun)</summary>

```text
./cmd/mo-inspect
./cmd/mo-object-tool/ckp
./cmd/mo-service
./cmd/mo-tool
./pkg/backup
./pkg/bootstrap
./pkg/bootstrap/versions/v1_2_0
./pkg/bootstrap/versions/v2_0_0
./pkg/bootstrap/versions/v2_0_1
./pkg/bootstrap/versions/v2_0_2
./pkg/bootstrap/versions/v2_2_0
./pkg/bootstrap/versions/v3_0_0
./pkg/bootstrap/versions/v4_0_0
./pkg/bootstrap/versions/v4_0_7
./pkg/cdc
./pkg/cnservice
./pkg/datasync
./pkg/embed
./pkg/fileservice
./pkg/frontend
./pkg/frontend/test/mock_moserver
./pkg/fulltext/plugin
./pkg/fulltext/plugin/compile
./pkg/fulltext/plugin/iscp
./pkg/fulltext/plugin/plan
./pkg/fulltext/plugin/search
./pkg/fulltext2
./pkg/fulltext2/plugin
./pkg/fulltext2/plugin/compile
./pkg/fulltext2/plugin/idxcron
./pkg/fulltext2/plugin/iscp
./pkg/fulltext2/plugin/plan
./pkg/fulltext2/plugin/search
./pkg/indexplugin
./pkg/indexplugin/all
./pkg/indexplugin/iscp
./pkg/indexplugin/plan
./pkg/iscp
./pkg/objectio
./pkg/partitionprune
./pkg/predefine
./pkg/proxy
./pkg/publication
./pkg/sql/colexec
./pkg/sql/colexec/adaptivetop
./pkg/sql/colexec/apply
./pkg/sql/colexec/dedupjoin
./pkg/sql/colexec/deletion
./pkg/sql/colexec/dependent
./pkg/sql/colexec/dispatch
./pkg/sql/colexec/external
./pkg/sql/colexec/fill
./pkg/sql/colexec/filter
./pkg/sql/colexec/fuzzyfilter
./pkg/sql/colexec/group
./pkg/sql/colexec/hashbuild
./pkg/sql/colexec/hashjoin
./pkg/sql/colexec/icebergwrite
./pkg/sql/colexec/indexbuild
./pkg/sql/colexec/insert
./pkg/sql/colexec/intersect
./pkg/sql/colexec/intersectall
./pkg/sql/colexec/limit
./pkg/sql/colexec/lockop
./pkg/sql/colexec/loopjoin
./pkg/sql/colexec/merge
./pkg/sql/colexec/mergeblock
./pkg/sql/colexec/mergecte
./pkg/sql/colexec/mergedelete
./pkg/sql/colexec/mergeorder
./pkg/sql/colexec/mergerecursive
./pkg/sql/colexec/mergetop
./pkg/sql/colexec/minus
./pkg/sql/colexec/minusall
./pkg/sql/colexec/mongoscan
./pkg/sql/colexec/multi_update
./pkg/sql/colexec/offset
./pkg/sql/colexec/order
./pkg/sql/colexec/output
./pkg/sql/colexec/partition
./pkg/sql/colexec/postdml
./pkg/sql/colexec/preinsert
./pkg/sql/colexec/preinsertsecondaryindex
./pkg/sql/colexec/preinsertunique
./pkg/sql/colexec/product
./pkg/sql/colexec/productl2
./pkg/sql/colexec/projection
./pkg/sql/colexec/rightdedupjoin
./pkg/sql/colexec/runtimefilter
./pkg/sql/colexec/sample
./pkg/sql/colexec/shuffle
./pkg/sql/colexec/spillutil
./pkg/sql/colexec/table_clone
./pkg/sql/colexec/table_function
./pkg/sql/colexec/table_scan
./pkg/sql/colexec/timewin
./pkg/sql/colexec/top
./pkg/sql/colexec/unionall
./pkg/sql/colexec/value_scan
./pkg/sql/colexec/vectorquery
./pkg/sql/colexec/vectorscan
./pkg/sql/colexec/window
./pkg/sql/compile
./pkg/sql/compile/siriusbridge
./pkg/sql/crt
./pkg/sql/internal/ordersites
./pkg/sql/internal/topsites
./pkg/sql/plan
./pkg/sql/plan/explain
./pkg/sql/plan/function
./pkg/sql/plan/rule
./pkg/sql/plan/substrait
./pkg/sql/util
./pkg/tests/arrowload
./pkg/tests/dml
./pkg/tests/issues
./pkg/tests/issues/internal/joinspill
./pkg/tests/issues/isolated
./pkg/tests/partition
./pkg/tests/service
./pkg/tests/shard
./pkg/tests/sqlintegration
./pkg/tests/sqlintegration/multicn
./pkg/tests/testutils
./pkg/tests/txn
./pkg/tests/upgrade
./pkg/tnservice
./pkg/tools/checkpointtool
./pkg/tools/checkpointtool/interactive
./pkg/txn/storage/tae
./pkg/util/status
./pkg/util/test
./pkg/vectorindex/cagra/plugin
./pkg/vectorindex/cagra/plugin/plan
./pkg/vectorindex/cagra/plugin/search
./pkg/vectorindex/hnsw
./pkg/vectorindex/hnsw/plugin
./pkg/vectorindex/hnsw/plugin/iscp
./pkg/vectorindex/hnsw/plugin/plan
./pkg/vectorindex/hnsw/plugin/search
./pkg/vectorindex/idxcron
./pkg/vectorindex/indexfile
./pkg/vectorindex/ivfflat
./pkg/vectorindex/ivfflat/plugin
./pkg/vectorindex/ivfflat/plugin/iscp
./pkg/vectorindex/ivfflat/plugin/plan
./pkg/vectorindex/ivfflat/plugin/search
./pkg/vectorindex/ivfpq
./pkg/vectorindex/ivfpq/plugin
./pkg/vectorindex/ivfpq/plugin/plan
./pkg/vectorindex/ivfpq/plugin/search
./pkg/vm/engine/ckputil
./pkg/vm/engine/disttae
./pkg/vm/engine/disttae/cache
./pkg/vm/engine/disttae/logtailreplay
./pkg/vm/engine/readutil
./pkg/vm/engine/tae/db
./pkg/vm/engine/tae/db/checkpoint
./pkg/vm/engine/tae/db/gc/v3
./pkg/vm/engine/tae/db/test
./pkg/vm/engine/tae/db/test/compatibility
./pkg/vm/engine/tae/db/testutil
./pkg/vm/engine/tae/logtail
./pkg/vm/engine/tae/logtail/service
./pkg/vm/engine/tae/rpc
./pkg/vm/engine/tae/testutils/config
./pkg/vm/engine/test
./pkg/vm/engine/test/testutil
./pkg/vm/pipeline
./test/manual/issue28140
```

</details>

- The real typed 1690/22003 wire outcome, same-connection recovery and
the 111/111 nometa + strict-metadata BVT passes were validated on the
real binary built from these same-semantics source bytes at base
43addc1; that older run is evidence for the SQL semantics and the
byte-frozen BVT goldens, not a claim about a binary of current main.

CI note: CI must be re-observed after the PR head is updated; there is
no green guarantee at publication time and no historical attempt is
claimed as the current state.

---------

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

## What type of PR is this?

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

## Which issue(s) this PR fixes:

Fixes #33126.

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

Restore MatrixOne's row-local NULL behavior for `POW` and `POWER` when a
finite negative base has a finite non-integer exponent. Both aliases use
the same evaluator. For example, a projection of `POWER(base, 0.5)` over
bases `1, -2, 4` now returns `1, NULL, 2`.

Previously, #32863 captured a domain error outside the per-row callback
and returned it after evaluating the batch. That made a single invalid
row abort the statement with MySQL error 1690. This change restores the
behavior from #28375 requested by #33126 and supersedes the
MySQL-compatible exception introduced for #31155.

The evaluator passes non-finite results from `math.Pow` to the existing
NULL-on-error vector helper. A shared internal error marker avoids
formatting an error for each invalid row. The tests cover both aliases,
mixed vectors, masks, aggregates, nullable writes, NOT NULL constraints,
and prepared executor reuse. A separate prepared projection uses integer
overflow to retain the existing check for recovery after a genuine
execution error.

### Upgrade compatibility for persisted CHECK constraints

An existing CHECK keeps the meaning it had when it was created.
MatrixOne v4.2.9 stored both function names as POW overload 0. That
overload still raises MySQL error 1690 (SQLSTATE 22003) for a non-finite
result. New SQL, including newly created constraints, binds both names
to overload 1 and returns NULL for that row. For `CHECK (POWER(b, 0.5) >
0)`, the two definitions admit the following writes after upgrade.

| Inserted value | CHECK created on v4.2.9 | CHECK created after upgrade
|
| --- | --- | --- |
| `-2` | 1690 | Accepted (UNKNOWN) |
| `0` | 3819 | 3819 |
| `4` or `NULL` | Accepted | Accepted |

A shutdown upgrade from the official v4.2.9 Linux/arm64 release to
commit `50e3a2cfb4` reproduced these results on the same persisted table
and on a fresh definition. A second constraint with a variable exponent
also retained 1690 for overflow and zero to a negative exponent.
Restart, CREATE TABLE LIKE and an ALTER of a column outside the
constraint preserved the released binding.

A retained v4.2.9 CHECK keeps its error behavior when ALTER converts a
directly referenced DOUBLE operand of POW to FLOAT. The new input can be
represented exactly by the old overload. A conversion that cannot
preserve the bound expression requires explicitly redefining the CHECK.
A newly declared CHECK uses row-local NULL semantics.

### Released backups and views

A v4.2.9 v1 table dump stores SQL and a schema fingerprint. LOAD can
recover a released POW binding in a CHECK, a generated column, or a
DEFAULT, including a constant DEFAULT whose stored value no longer
contains the function ID. The original CREATE and catalog scopes can
differ in their column nullability annotations. Recovery checks the
complete candidate trees and rejects differences that change the
computed expression. It installs the verified definition and the data in
one transaction.

LOAD also checks the table and relation fingerprints. It can reproduce
the old spelling of an implicit table default when all columns and
expressions are independent of text collation, including numeric POW
constraints on tables with DATE, DATETIME, UUID, BINARY, or VARBINARY
columns. For a v3 dump from an upgraded table, this compatibility path
also requires a verified bound-expression payload containing a released
POW binding and matching physical and logical fingerprints for the main
relation.

At `985a0d35e6`, a newly initialized target loaded three v1 archives
from the official v4.2.9 release. These covered a STORED generated
column with data, a metadata-only STORED column, and a metadata-only
VIRTUAL column. All three generated-column catalog payloads matched the
release byte for byte, including after restart. The restored columns
raised 1690 for a negative base and fractional exponent, while the same
expression on a freshly created table produced NULL. A missing data
object rolled back both the rows and the expression change. A mismatched
target declaration was rejected.

Views created on v4.2.9 retain error 1690 when expanded after upgrade,
including through nested views. New views and explicit ALTER VIEW
statements use row-local NULL. The planner scopes binding to each stored
definition, so outer SQL and views from different releases can be
combined.

Verified at `a74be94e2b` using the [official v4.2.9
release](https://github.com/matrixorigin/matrixone/releases/tag/v4.2.9)
on Linux/arm64 and a freshly built macOS/arm64 target with Go 1.27.1.
The stopped release data directory was reopened with the target binary
for the view checks. The backups were loaded into a separate, newly
initialized target.

- On a clean target, a full v1 dump restored both original rows and a
metadata-only v1 dump restored an anonymous CHECK. Both constraints
raised 1690 for a negative fractional power after restart. An unrelated
fresh CHECK accepted the same input.
- A missing data object failed the load and left the empty target with
its original NULL-producing constraint. Retrying with the complete
archive succeeded. Changing the predicate from `> 0` to `>= 0` failed
the schema check.
- After a shutdown upgrade, direct and nested released views raised
1690. An INSERT SELECT from the released view wrote zero rows. A fresh
view produced NULL and an explicit ALTER of an old view took effect
through an unchanged outer view. These behaviors survived restart.
- 117 focused Go tests passed. Focused coverage of executable Go
statements in blocks changed by this review fix reached 87.8%. The
affected packages passed the pinned static checks. The POWER BVT passed
all 113 statements.

At `ca96bccd40`, the official v4.2.9 release rejected `-2` before and
after altering the constrained column to FLOAT. The target reproduced
both outcomes on the same released data after a shutdown upgrade. Both
NOT NULL column cases and both forms of DEFAULT loaded from v1 archives.
The archived result of POWER(2,3) was 8, the runtime default remained a
function call, and the upgraded tables could be dumped again and loaded
into newly created tables. A DATE/DATETIME schema mismatch and modified
v3 fingerprints were rejected.

### Released generated columns, table dumps, and SQL functions

COPY ALTER preserves the bound POWER operation in retained STORED and
VIRTUAL generated columns when the operand conversion is safe. An
incompatible change requires an explicit new generated definition. On
the released `DOUBLE NOT NULL` to `FLOAT NOT NULL` case, the upgraded
table still rejects a negative fractional power with 1690 and keeps its
valid row.

A v3 re-dump can restore a released anonymous CHECK onto the target's
generated constraint name. The compatibility check also recognizes the
qualified internal CREATE name emitted by the v4.2.9 COPY ALTER
implementation for the same logical table. LOAD verifies the
declarations, the table and main relation fingerprints and, for v3, the
original bound payload.

SQL UDF bodies bind their own POWER calls under the definition's stored
semantics. Call arguments keep their caller's semantics. Ordinary
arithmetic function bodies retain their original catalog text. Cloning a
query-bodied function that references its source database preserves its
positional arguments as well as its POWER behavior.

At `4c1adb1583`, the clean service reopened stopped databases from the
official v4.2.9 release. All five released table shapes loaded from both
their original v1 archives and their upgraded v3 re-dumps into freshly
created targets. Both formats preserved 1690 for a negative fractional
power and 3819 for zero. Recovery rejected a changed binary width,
mismatched internal table names and a v3 payload with a different CHECK
owner. Direct, nested, view, restart, database clone and snapshot clone
probes preserved released and current SQL UDF behavior. The POWER BVT
passed 113/113 statements and the existing account snapshot UDF section
passed 51/51. Coverage of executable Go statements in blocks touched by
this review fix reached 91.3%.

### SQL function clones, internal queries, and released table recovery

When EXECUTE rebinds a POWER call to the supplied argument types, it
preserves the overload selected for the function definition. In a
shutdown upgrade from v4.2.9, executing a prepared `SET @out =
released_pow(?)` with -2 raises error 1690 and leaves the variable
unchanged. The same assignment through a newly defined function stores
NULL. Both definitions return 4 for 16. These results were verified with
SQL PREPARE and the MySQL binary prepared-statement protocol on the
upgraded server and after restart.

The SQL function binder and database cloner now use the same parser to
distinguish complete queries from scalar expressions. This preserves set
queries with a parenthesized first operand, TABLE query terms, and
queries preceded by empty statements. In a shutdown upgrade from v4.2.9,
the stored function with body `(select 1 where 1=0) union all select 2`
returned `2` after upgrade, cloning, and restart. Released POWER
functions kept error 1690 for a negative fractional power, and newly
created functions returned NULL. A released function with body `perform
select 7` also returned 7 after upgrade, cloning, and restart. The same
tests verified that `perform` still works as a column name in a scalar
function body.

Database cloning rewrites source-qualified subqueries inside scalar SQL
function bodies and preserves the definition's SQL mode, positional
arguments and binary literals. The frontend and the internal query
compiler use the same decoder for released and current function
definitions. A cloned function reads the clone after the source table is
dropped. A view calling POWER can also supply rows to `ivf_create`.

Restoring a released table now accounts for ordinary RENAME and the way
released SHOW CREATE prints primary keys, unnamed CHECK constraints and
NULL defaults. LOAD verifies the declaration, bound expressions and
relation fingerprints. A numeric POWER constraint can be restored
alongside JSON and vector values. For regular secondary indexes, LOAD
checks the actual key parts and reconstructs the released representation
of the packed key before accepting the index objects.

Using the official Linux/arm64 v4.2.9 server, we generated full v1
archives with table and index data. After a shutdown upgrade we
generated v3 archives and loaded both formats into recreated tables.
Tests checked the stored data after restart, queried the restored
secondary index after another write, and verified 1690 for negative
fractional powers and 3819 for a false CHECK. Mismatched predicates,
constraint names, vector dimensions and mixed index fingerprints were
rejected. Changing the bound type of a JSON default or a vector
default’s dimension was rejected even after recomputing the v3
expression digest. The target stayed empty. A missing index object
rolled back the load and the genuine archive could be retried.

At `07494aeb90`, 160 top-level Go tests passed, including the real
projection error recovery test on two consecutive runs. Coverage of
executable statements in blocks touched by this follow-up was 89.0%
(380/427). The POWER BVT passed all 113 statements, and the four
affected packages passed the pinned static checks.

Validation on macOS arm64 using Go 1.27.1 and a freshly built single-CN
CPU service:

- Six new or updated subtests reproduced the original out-of-range error
against the base implementation. The full function package passed with
the fix. Statement coverage was 100% for `Power` and 76.8% for the
package.
- Both focused prepared TP projection tests passed.
- The two original MOTR regressions at `matrixorigin/motr@f0b2def2`
passed all 28 statements. Both issue reproducers also returned NULL over
the MySQL protocol.
- mo-tester generated the POWER results. Its final comparison passed all
113 statements with the repository-format golden.
- `go vet`, the repository-pinned `molint` and `golangci-lint` passed
for both changed Go packages. Formatting and `git diff --check` passed.

Review follow-up:

- The genuine BIGINT projection error test now exercises two
success/overflow/recovery cycles on the same prepared executor and
compares retained memory after both recoveries. It still asserts the
out-of-range error, failed-batch suppression and recovered values. The
two focused TP tests passed ten repetitions. The changed compile package
passed vet and the repository-pinned static checks.
- matrixorigin/motr#358 now includes the companion regression update at
`5a7d8a8`. Before the update, seven assertions expecting 1690 failed on
this evaluator and the other fifteen passed. The updated case verifies
five scalar NULL results, both rows of a mixed vector, and a stored
NULL. Together with the existing #25308 and #28137 MOTR cases it passed
three replays each. Coordinate the MOTR rollout with this kernel change
so the updated regression is run against a build containing it.

---------

Co-authored-by: XuPeng-SH <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/api-change kind/bug Something isn't working size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Compatibility]: POWER, EXP overflow and COT domain errors abort queries instead of returning NULL

3 participants