Skip to content

fix: canonicalize CHAR and JSON HLL_ADD_AGG keys - #29123

Merged
XuPeng-SH merged 5 commits into
mainfrom
issue/28859-28860-canonical-keys
Sep 20, 2026
Merged

XuPeng-SH merged 5 commits into
mainfrom
issue/28859-28860-canonical-keys

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

Fixes #28859
Fixes #28860

What this PR does / why we need it:

main already contains the CHAR/JSON canonical key fixes for GROUP BY, SELECT DISTINCT, exact DISTINCT, and APPROX_COUNT_DISTINCT. The remaining defect is that new HLL_ADD_AGG executors still hash raw CHAR/JSON bytes.

This PR:

  • uses the existing HLL v4 typed-equivalence key for new CHAR and JSON HLL_ADD_AGG states;
  • keeps VARCHAR trailing spaces significant and leaves other scalar HLL_ADD inputs on the existing v2 contract;
  • preserves restored v2 states and their raw append semantics;
  • keeps non-empty v2/v4 merges rejected instead of mixing incompatible hash domains;
  • preserves vector HLL at MORPC v88 and main contracts decimal v89/spatial v90;
  • assigns CHAR/JSON canonical HLL to MORPC v91. Remote producers through v90 stay on v2; compile-time placement and execution-time receiver checks require v91;
  • adds executor, restore, v88/v90/v91 gate, and distributed BVT coverage.

Validation evidence

PASS at exact head a6df30b3f605fc61062faa45831d441e69f09ea8 on main 5e1e93ae35efc6eea54ae2935f68154493d6e95c:

  • git diff --check;
  • gofmt on all changed Go files;
  • GPT-6 medium final whole-change review: no P0/P1/P2 blockers;
  • source review confirms v88 vector, v89 decimal, v90 spatial, and v91 CHAR/JSON HLL remain distinct.

NOT VERIFIED locally:

  • focused runtime UT and incremental vet/lint: the worktree lacks provenance-verified MatrixOne native/CGo artifacts (libmo.so, usearch/roaring/jemalloc headers);
  • normal-comparison distributed BVT and actual mixed-binary restart/rollback execution: no owned deployment.

Fresh exact-head CI is the verification source and is pending. Historical CI from prior heads is not claimed for this revision.

Remaining risks

Existing persisted v2 CHAR/JSON HLL sketches cannot be canonicalized from register state. They retain v2 raw semantics when appended; mixing a non-empty historical v2 sketch with a new v4 sketch is rejected by design. Rebuild historical sketches from source rows to obtain canonical v4 semantics. Rollback is a branch revert; peers below v91 continue to receive legacy v2 CHAR/JSON states.

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

@mergify mergify Bot added kind/bug Something isn't working kind/test-ci labels Sep 20, 2026
@matrix-meow matrix-meow added the size/L Denotes a PR that changes [500,999] lines label Sep 20, 2026
@XuPeng-SH
XuPeng-SH force-pushed the issue/28859-28860-canonical-keys branch from 060d38b to 94936e3 Compare September 20, 2026 04:06
@XuPeng-SH
XuPeng-SH force-pushed the issue/28859-28860-canonical-keys branch from 94936e3 to 5c29631 Compare September 20, 2026 08:42
@XuPeng-SH

XuPeng-SH commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor Author

Rebased onto main at 22d43911d3f6c51872c1852340265a7d3f206925 and pushed exact head 5c296313693a4773c552bc59d537781e53add4f1.

Key rebase fix:

  • preserved vector canonical HLL_ADD_AGG as the existing MORPC v88 contract;
  • allocated MORPC v89 for CHAR/JSON canonical keys;
  • split producer fallback and remote admission gates, so v88 mixed deployments keep CHAR/JSON on legacy v2 while vectors may use v4;
  • removed a duplicate helper introduced during conflict resolution and updated v88/v89 regression assertions.

Review: GPT-6 medium final review found four blockers in the first rebased revision; all were fixed. Incremental re-review of 5c29631369 found no remaining P0-P2 blockers. gofmt and git diff --check pass.

Validation status:

  • PASS: formatting and diff integrity.
  • Historical only (old head 94936e3): SCA, coverage, PROXY multi-CN BVT, and COMPOSE/PESSIMISTIC BVT passed. These are not claimed for the new head.
  • NOT VERIFIED locally: focused package UT, incremental vet/lint, BVT, and mixed-version execution because this machine lacks the required MatrixOne native/CGo artifacts (libmo.so, usearch/roaring/jemalloc headers). New-head CI is the verification source.

The old-head UT failure was unrelated: pkg/lockservice/TestHandleBindChangedConcurrently timed out under race while this PR does not touch lockservice. Recurrence tracked in #29165 (prior closed report #26637).

Rollback: revert the four PR commits; v88 vector behavior remains independently versioned from the new v89 CHAR/JSON behavior.

@XuPeng-SH

Copy link
Copy Markdown
Contributor Author

PASS — exact head a6df30b3f605fc61062faa45831d441e69f09ea8,自有 PR 按规则只留 COMMENT。

复核了 CHAR/JSON typed HLL_ADD_AGG hash domain、pre-v91 remote fallback、legacy v2 state restore,以及 compile/shuffle protocol gate;未发现 P0/P1/P2 功能问题。相关单测与当前 CI 均通过。

非阻塞备注:group helper 的一处注释仍写 CHAR/JSON at v89,而实际协议门槛已是 v91,建议后续顺手统一文档。

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

PASS — exact head a6df30b3f605fc61062faa45831d441e69f09ea8,自有 PR 按规则只留 COMMENT。

复核了 CHAR/JSON typed HLL_ADD_AGG hash domain、pre-v91 remote fallback、legacy v2 state restore,以及 compile/shuffle protocol gate;未发现 P0/P1/P2 功能问题。相关单测与当前 CI 均通过。

@XuPeng-SH
XuPeng-SH merged commit a873bcf into main Sep 20, 2026
26 of 27 checks passed
@XuPeng-SH
XuPeng-SH deleted the issue/28859-28860-canonical-keys branch September 20, 2026 13:00

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/bug Something isn't working kind/test-ci size/L Denotes a PR that changes [500,999] lines

Projects

None yet

2 participants