Skip to content

docs: design JSON SQL and physical ordering boundaries - #28315

Closed
VioletQwQ-0 wants to merge 1 commit into
matrixorigin:mainfrom
VioletQwQ-0:codex/issue-28039-order-design
Closed

VioletQwQ-0 wants to merge 1 commit into
matrixorigin:mainfrom
VioletQwQ-0:codex/issue-28039-order-design

Conversation

@VioletQwQ-0

Copy link
Copy Markdown
Collaborator

What type of PR is this?

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

Which issue(s) this PR fixes:

Design prerequisite for issue #28039 and implementation PR #28086. This proposal does not close either item.

What this PR does / why we need it:

PR #28086 now separates SQL JSON ordering from persisted writer and merger relations. Its independent design gate is still open. This docs-only PR supplies version 1 for a distinct design review before further implementation delivery.

The design covers SQL ordering/hash equality, malformed input domains, exact admission ownership, legacy writer-versus-merger compatibility, mixed-version query limitations, alternatives, hot-path and admission costs, and terminal acceptance tests. It explicitly records that source head 715dc8dfa531c0558355fe83bfa79da0ac9a798a does not establish the trusted SQL comparison precondition: a new production-entry probe passes a malformed JSON vector through checked deserialization and observes a SQL comparison inconsistent with public fallback ordering.

Requested independent decision: approve or request changes on this exact document revision, especially raw-input rejection at admission, preservation of both existing physical relations, and homogeneous query-executor rollout. This PR does not claim design approval, implementation conformance, semantic preflight PASS, or CR closure. Implementation #28086 must remain blocked until design approval and the missing admission/terminal-test work are complete.

Validation: documentation/source contract review and git diff --check. Supporting source-head verification used locally built native inputs and mo-cgo-test: ten existing named CR regressions passed; the new admission counterexample failed as expected. These are evidence about #28086, not execution coverage supplied by this docs-only PR.

BVT: N/A — only a proposed design document changes; there is no executable, SQL, result, or configuration change. The implementation's BVT and QA gates remain in force.

@VioletQwQ-0

Copy link
Copy Markdown
Collaborator Author

Consolidated unchanged into #28086 at commit 19d8c39598f4db81c69d005be2c9718866ff7c2c, per the author's request. The versioned design is now docs/design/json_sql_physical_order.md in that PR, and the independent design review request has moved there. This standalone PR remains closed; its merge is not a prerequisite. Design approval and implementation fixes are still pending.

XuPeng-SH added a commit that referenced this pull request Sep 12, 2026
## What type of PR is this?

- [x] BUG

## Which issue(s) this PR fixes:

issue #28039

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

Correct SQL JSON precedence while keeping persisted writer ordering and
both raw TAE merger relations unchanged. JSON value-based zone-map
pruning fails open; null-count pruning remains available. Numeric peer
equality agrees with canonical hash keys. `MIN/MAX(JSON)` remains
unsupported and `MIN/MAX(NULL)` retains its previous type.

Raw JSON vector writes now validate every descendant before publishing a
row. Checked binary, copied, reader, selected-row, legacy and raw-copy
decoders reject corrupt non-NULL payloads before publication. Encoders
validate their emitted bytes; failed appends/replacements preserve
visible state. Same-type copies/unions and the existing sealed objectio
V2 cache retain explicit immutable admitted-source preconditions. Direct
SQL comparison therefore uses the trusted comparator without a full
descendant walk per comparison or a full-column cache. Public ByteJSON
comparison/hash retain deterministic raw fallback for malformed
diagnostic values.

Version 3 of [the
design](https://github.com/VioletQwQ-0/matrixone/blob/396d983ec8e4027b86b4c92f425a862fcb9e2bf7/docs/design/json_sql_physical_order.md)
records these admission owners, unchanged physical relations,
resource-policy limits and the homogeneous-query rollout requirement.
The separate design PR #28315 is closed and its document is consolidated
here. **Independent design approval remains pending; local
repair/preflight is not that approval.**

Validation for `396d983ec8e4027b86b4c92f425a862fcb9e2bf7`:

- This update adds test assertions only; production content is unchanged
from acb817e. Shared serialized-byte traversal budget and depth
limit100 remain in force. An isolated old-validator baseline fails the
alias-work/depth tests; current boundary tests pass.
- New assertions verify valid reuse after rejected raw writes and
checked decode, retained/empty visible state, failed raw-copy
constructor returning nil, and terminal mpool cleanup. Existing
admission tests and full validator/vector race packages pass; focused
stress counts use recorded timing measurements.
- Fresh CGo core/consumer/affected-fixture package checks and ISCP pass.
Build/vet and diff-check pass. Focused admission measurements observed
zero allocations for small/wide inputs; race is not a complexity or
resource-release proof.
- Real service canonical JSON ordering/window BVT passes 47/47,
including new RANK/DENSE_RANK numeric peers. Retained-run physical
merger/write/read tests pass; no rolling-upgrade acceptance is claimed.
- The preceding head's GitHub Coverage failed in the SNAPSHOT registry
guard, with dependent Coverage blocked; existing #28259 records the same
signature. Local CI-tagged SNAPSHOT passes, but the complete issues
package fails on a distinct CDC writer-wins waiter timeout (historical
context #28282). That CDC case passes in isolation. Both results are
retained; the entire package is not called PASS.
- Whole-diff schema-v7 review/mapping remains PENDING. The unsupported
prior overall PASS stays withdrawn. New-head CI, independent version3
design approval, review decisions and QA remain required.
- Continuing correction and reproducible evidence summary:
#28086 (comment)

QA required: yes. This changes visible SQL comparison/order/hash
behavior and corruption handling. Automated coverage reaches direct SQL,
multi-key/numeric peers, pruning, checked admission and real merger
object readback. Independent design approval, required current-head CI,
review approval, and versioned QA on homogeneous query-executing CNs
remain required. Keep #28039 open until explicit QA acceptance; this PR
does not request issue closure.


### Evidence correction — 2026-09-08

Evidence correction (2026-09-08): the whole-diff semantic PASS
previously reported here is withdrawn. The manifest generator copied
expected results into observed results and set PASS unconditionally; the
validator checked declarations and coverage structure, not their truth.
Individual executable results are separate evidence and are being
checked against their exact content and test assertions. Overall
semantic review is PENDING. This correction does not claim that all
tests were invalid or that the code repair failed. Current-head CI,
reviewer approval and applicable design/QA gates remain separate.

---------

Co-authored-by: XuPeng-SH <[email protected]>
VioletQwQ-0 added a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## What type of PR is this?

- [x] BUG

## Which issue(s) this PR fixes:

issue matrixorigin#28039

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

Correct SQL JSON precedence while keeping persisted writer ordering and
both raw TAE merger relations unchanged. JSON value-based zone-map
pruning fails open; null-count pruning remains available. Numeric peer
equality agrees with canonical hash keys. `MIN/MAX(JSON)` remains
unsupported and `MIN/MAX(NULL)` retains its previous type.

Raw JSON vector writes now validate every descendant before publishing a
row. Checked binary, copied, reader, selected-row, legacy and raw-copy
decoders reject corrupt non-NULL payloads before publication. Encoders
validate their emitted bytes; failed appends/replacements preserve
visible state. Same-type copies/unions and the existing sealed objectio
V2 cache retain explicit immutable admitted-source preconditions. Direct
SQL comparison therefore uses the trusted comparator without a full
descendant walk per comparison or a full-column cache. Public ByteJSON
comparison/hash retain deterministic raw fallback for malformed
diagnostic values.

Version 3 of [the
design](https://github.com/VioletQwQ-0/matrixone/blob/396d983ec8e4027b86b4c92f425a862fcb9e2bf7/docs/design/json_sql_physical_order.md)
records these admission owners, unchanged physical relations,
resource-policy limits and the homogeneous-query rollout requirement.
The separate design PR matrixorigin#28315 is closed and its document is consolidated
here. **Independent design approval remains pending; local
repair/preflight is not that approval.**

Validation for `396d983ec8e4027b86b4c92f425a862fcb9e2bf7`:

- This update adds test assertions only; production content is unchanged
from acb817e. Shared serialized-byte traversal budget and depth
limit100 remain in force. An isolated old-validator baseline fails the
alias-work/depth tests; current boundary tests pass.
- New assertions verify valid reuse after rejected raw writes and
checked decode, retained/empty visible state, failed raw-copy
constructor returning nil, and terminal mpool cleanup. Existing
admission tests and full validator/vector race packages pass; focused
stress counts use recorded timing measurements.
- Fresh CGo core/consumer/affected-fixture package checks and ISCP pass.
Build/vet and diff-check pass. Focused admission measurements observed
zero allocations for small/wide inputs; race is not a complexity or
resource-release proof.
- Real service canonical JSON ordering/window BVT passes 47/47,
including new RANK/DENSE_RANK numeric peers. Retained-run physical
merger/write/read tests pass; no rolling-upgrade acceptance is claimed.
- The preceding head's GitHub Coverage failed in the SNAPSHOT registry
guard, with dependent Coverage blocked; existing matrixorigin#28259 records the same
signature. Local CI-tagged SNAPSHOT passes, but the complete issues
package fails on a distinct CDC writer-wins waiter timeout (historical
context matrixorigin#28282). That CDC case passes in isolation. Both results are
retained; the entire package is not called PASS.
- Whole-diff schema-v7 review/mapping remains PENDING. The unsupported
prior overall PASS stays withdrawn. New-head CI, independent version3
design approval, review decisions and QA remain required.
- Continuing correction and reproducible evidence summary:
matrixorigin#28086 (comment)

QA required: yes. This changes visible SQL comparison/order/hash
behavior and corruption handling. Automated coverage reaches direct SQL,
multi-key/numeric peers, pruning, checked admission and real merger
object readback. Independent design approval, required current-head CI,
review approval, and versioned QA on homogeneous query-executing CNs
remain required. Keep matrixorigin#28039 open until explicit QA acceptance; this PR
does not request issue closure.


### Evidence correction — 2026-09-08

Evidence correction (2026-09-08): the whole-diff semantic PASS
previously reported here is withdrawn. The manifest generator copied
expected results into observed results and set PASS unconditionally; the
validator checked declarations and coverage structure, not their truth.
Individual executable results are separate evidence and are being
checked against their exact content and test assertions. Overall
semantic review is PENDING. This correction does not claim that all
tests were invalid or that the code repair failed. Current-head CI,
reviewer approval and applicable design/QA gates remain separate.

---------

Co-authored-by: XuPeng-SH <[email protected]>
VioletQwQ-0 added a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## What type of PR is this?

- [x] BUG

## Which issue(s) this PR fixes:

issue matrixorigin#28039

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

Correct SQL JSON precedence while keeping persisted writer ordering and
both raw TAE merger relations unchanged. JSON value-based zone-map
pruning fails open; null-count pruning remains available. Numeric peer
equality agrees with canonical hash keys. `MIN/MAX(JSON)` remains
unsupported and `MIN/MAX(NULL)` retains its previous type.

Raw JSON vector writes now validate every descendant before publishing a
row. Checked binary, copied, reader, selected-row, legacy and raw-copy
decoders reject corrupt non-NULL payloads before publication. Encoders
validate their emitted bytes; failed appends/replacements preserve
visible state. Same-type copies/unions and the existing sealed objectio
V2 cache retain explicit immutable admitted-source preconditions. Direct
SQL comparison therefore uses the trusted comparator without a full
descendant walk per comparison or a full-column cache. Public ByteJSON
comparison/hash retain deterministic raw fallback for malformed
diagnostic values.

Version 3 of [the
design](https://github.com/VioletQwQ-0/matrixone/blob/396d983ec8e4027b86b4c92f425a862fcb9e2bf7/docs/design/json_sql_physical_order.md)
records these admission owners, unchanged physical relations,
resource-policy limits and the homogeneous-query rollout requirement.
The separate design PR matrixorigin#28315 is closed and its document is consolidated
here. **Independent design approval remains pending; local
repair/preflight is not that approval.**

Validation for `396d983ec8e4027b86b4c92f425a862fcb9e2bf7`:

- This update adds test assertions only; production content is unchanged
from acb817e. Shared serialized-byte traversal budget and depth
limit100 remain in force. An isolated old-validator baseline fails the
alias-work/depth tests; current boundary tests pass.
- New assertions verify valid reuse after rejected raw writes and
checked decode, retained/empty visible state, failed raw-copy
constructor returning nil, and terminal mpool cleanup. Existing
admission tests and full validator/vector race packages pass; focused
stress counts use recorded timing measurements.
- Fresh CGo core/consumer/affected-fixture package checks and ISCP pass.
Build/vet and diff-check pass. Focused admission measurements observed
zero allocations for small/wide inputs; race is not a complexity or
resource-release proof.
- Real service canonical JSON ordering/window BVT passes 47/47,
including new RANK/DENSE_RANK numeric peers. Retained-run physical
merger/write/read tests pass; no rolling-upgrade acceptance is claimed.
- The preceding head's GitHub Coverage failed in the SNAPSHOT registry
guard, with dependent Coverage blocked; existing matrixorigin#28259 records the same
signature. Local CI-tagged SNAPSHOT passes, but the complete issues
package fails on a distinct CDC writer-wins waiter timeout (historical
context matrixorigin#28282). That CDC case passes in isolation. Both results are
retained; the entire package is not called PASS.
- Whole-diff schema-v7 review/mapping remains PENDING. The unsupported
prior overall PASS stays withdrawn. New-head CI, independent version3
design approval, review decisions and QA remain required.
- Continuing correction and reproducible evidence summary:
matrixorigin#28086 (comment)

QA required: yes. This changes visible SQL comparison/order/hash
behavior and corruption handling. Automated coverage reaches direct SQL,
multi-key/numeric peers, pruning, checked admission and real merger
object readback. Independent design approval, required current-head CI,
review approval, and versioned QA on homogeneous query-executing CNs
remain required. Keep matrixorigin#28039 open until explicit QA acceptance; this PR
does not request issue closure.


### Evidence correction — 2026-09-08

Evidence correction (2026-09-08): the whole-diff semantic PASS
previously reported here is withdrawn. The manifest generator copied
expected results into observed results and set PASS unconditionally; the
validator checked declarations and coverage structure, not their truth.
Individual executable results are separate evidence and are being
checked against their exact content and test assertions. Overall
semantic review is PENDING. This correction does not claim that all
tests were invalid or that the code repair failed. Current-head CI,
reviewer approval and applicable design/QA gates remain separate.

---------

Co-authored-by: XuPeng-SH <[email protected]>
VioletQwQ-0 added a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## What type of PR is this?

- [x] BUG

## Which issue(s) this PR fixes:

issue matrixorigin#28039

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

Correct SQL JSON precedence while keeping persisted writer ordering and
both raw TAE merger relations unchanged. JSON value-based zone-map
pruning fails open; null-count pruning remains available. Numeric peer
equality agrees with canonical hash keys. `MIN/MAX(JSON)` remains
unsupported and `MIN/MAX(NULL)` retains its previous type.

Raw JSON vector writes now validate every descendant before publishing a
row. Checked binary, copied, reader, selected-row, legacy and raw-copy
decoders reject corrupt non-NULL payloads before publication. Encoders
validate their emitted bytes; failed appends/replacements preserve
visible state. Same-type copies/unions and the existing sealed objectio
V2 cache retain explicit immutable admitted-source preconditions. Direct
SQL comparison therefore uses the trusted comparator without a full
descendant walk per comparison or a full-column cache. Public ByteJSON
comparison/hash retain deterministic raw fallback for malformed
diagnostic values.

Version 3 of [the
design](https://github.com/VioletQwQ-0/matrixone/blob/396d983ec8e4027b86b4c92f425a862fcb9e2bf7/docs/design/json_sql_physical_order.md)
records these admission owners, unchanged physical relations,
resource-policy limits and the homogeneous-query rollout requirement.
The separate design PR matrixorigin#28315 is closed and its document is consolidated
here. **Independent design approval remains pending; local
repair/preflight is not that approval.**

Validation for `396d983ec8e4027b86b4c92f425a862fcb9e2bf7`:

- This update adds test assertions only; production content is unchanged
from acb817e. Shared serialized-byte traversal budget and depth
limit100 remain in force. An isolated old-validator baseline fails the
alias-work/depth tests; current boundary tests pass.
- New assertions verify valid reuse after rejected raw writes and
checked decode, retained/empty visible state, failed raw-copy
constructor returning nil, and terminal mpool cleanup. Existing
admission tests and full validator/vector race packages pass; focused
stress counts use recorded timing measurements.
- Fresh CGo core/consumer/affected-fixture package checks and ISCP pass.
Build/vet and diff-check pass. Focused admission measurements observed
zero allocations for small/wide inputs; race is not a complexity or
resource-release proof.
- Real service canonical JSON ordering/window BVT passes 47/47,
including new RANK/DENSE_RANK numeric peers. Retained-run physical
merger/write/read tests pass; no rolling-upgrade acceptance is claimed.
- The preceding head's GitHub Coverage failed in the SNAPSHOT registry
guard, with dependent Coverage blocked; existing matrixorigin#28259 records the same
signature. Local CI-tagged SNAPSHOT passes, but the complete issues
package fails on a distinct CDC writer-wins waiter timeout (historical
context matrixorigin#28282). That CDC case passes in isolation. Both results are
retained; the entire package is not called PASS.
- Whole-diff schema-v7 review/mapping remains PENDING. The unsupported
prior overall PASS stays withdrawn. New-head CI, independent version3
design approval, review decisions and QA remain required.
- Continuing correction and reproducible evidence summary:
matrixorigin#28086 (comment)

QA required: yes. This changes visible SQL comparison/order/hash
behavior and corruption handling. Automated coverage reaches direct SQL,
multi-key/numeric peers, pruning, checked admission and real merger
object readback. Independent design approval, required current-head CI,
review approval, and versioned QA on homogeneous query-executing CNs
remain required. Keep matrixorigin#28039 open until explicit QA acceptance; this PR
does not request issue closure.


### Evidence correction — 2026-09-08

Evidence correction (2026-09-08): the whole-diff semantic PASS
previously reported here is withdrawn. The manifest generator copied
expected results into observed results and set PASS unconditionally; the
validator checked declarations and coverage structure, not their truth.
Individual executable results are separate evidence and are being
checked against their exact content and test assertions. Overall
semantic review is PENDING. This correction does not claim that all
tests were invalid or that the code repair failed. Current-head CI,
reviewer approval and applicable design/QA gates remain separate.

---------

Co-authored-by: XuPeng-SH <[email protected]>

This branch was previously deployed

1 inactive deployment
ci — 7f6ffa1d Deployed Sep 7, 2026 by VioletQwQ-0 via Matrixone Utils CI / Coverage #51174
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/documentation Improvements or additions to documentation size/XS Denotes a PR that changes [1, 9] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants