Skip to content

test: expand GoJieba fulltext BVT coverage - #25897

Merged
mergify[bot] merged 14 commits into
mainfrom
test/gojieba-bvt-coverage
Aug 29, 2026
Merged

mergify[bot] merged 14 commits into
mainfrom
test/gojieba-bvt-coverage

Conversation

@Ariznawlll

@Ariznawlll Ariznawlll commented Jul 20, 2026 •

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:

Issue: #25896

QA required: yes

What this PR does / why we need it:

add bvt case for gojieba

@matrix-meow matrix-meow added size/L Denotes a PR that changes [500,999] lines and removed size/M Denotes a PR that changes [100,499] lines labels Jul 20, 2026
@Ariznawlll
Ariznawlll marked this pull request as ready for review July 20, 2026 09:02
@Ariznawlll
Ariznawlll requested a review from a user July 20, 2026 09:02
@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 →

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

Codex automated review

One non-blocking BVT determinism issue found. Tokenizer unit tests pass; broader tests were blocked by missing local C headers.

P2 - Order exact tokenizer results explicitly (test/distributed/cases/fulltext/gojieba_precise.sql:10)

The six select f.pos, f.word queries assert a specific row sequence, including __DocLen last, but have no ORDER BY. SQL does not guarantee table-function result order, so plan or distributed-execution changes can make this BVT flaky without changing tokenization. Add ORDER BY f.pos to each exact-token query.

@Ariznawlll
Ariznawlll marked this pull request as draft July 20, 2026 11:25

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

Codex automated review

Follow-up review of head 1161938. Prior review surface: my 2026-07-20 review raised one P2 (non-blocking) finding — the six select f.pos, f.word tokenizer queries in gojieba_precise.sql asserted row order without ORDER BY. That is FIXED in e7b963e: all six queries now end with order by f.word = '__DocLen', f.pos, which is deterministic and correctly pins __DocLen last (its pos is the token count — e.g. 'red red red' emits DocLen pos=3, which a plain ORDER BY f.pos would interleave between tokens at 0/4/8, so the author's variant is more robust than the suggested fix). No other prior blockers exist. The four merge commits since the previously reviewed head (cd677ca, 306f2c8, cfb3b2e, 1161938) all have empty remerge-diffs (clean merges); upstream changes arriving through them (e.g. fulltext.result score updates, prepared-statement fulltext cases) are not authored by this PR and were excluded. The entire PR surface vs merge-base is 4 new files (gojieba_precise.sql/.result, fulltext_query_shapes.sql/.result, 515 insertions, test-only). I verified every precise assertion against the implementation: byte-offset positions (Pos=BytePos, pkg/sql/colexec/table_function/fulltext_tokenize.go:194), __DocLen.pos = token count emitted only when tokens exist (fulltext_tokenize.go:272-273), 23-byte cap with UTF-8-safe truncation and lower-casing (pkg/monlp/tokenizer/jieba.go), HMM disabled on the SQL path (SharedJiebaTokenizer(false)) matching the 他/来到/了/网易/杭/研/大厦 segmentation, single-newline multi-column join with NULL-column skip (fulltext_tokenize.go:148) supporting both the multi-column token offsets and the phrase-boundary negative (phrase matching is byte-position based, so the boundary byte breaks adjacency). The two expected-value corrections in e7b963e (+nullbodytoken → id 4; +lifecyclebody after title→NULL → id 6) match both the documented intent in the SQL comments and the index-build semantics. @SortKey:0 is a valid mo-tester flag used elsewhere in the suite. The @bvt:issue#25890 tag is valid (issue open). One new non-blocking finding: the @bvt:issue#25891 tag is stale because #25891 was fixed and the fix is already in this branch's HEAD. No other reviewer findings exist to dedupe against (PR history contains only my prior review and no inline comments).

non-blocking - Stale @bvt:issue#25891 tag: the IN-subquery MATCH shape is already fixed and never executed (test/distributed/cases/fulltext/fulltext_query_shapes.sql:70)

The block at lines 69-78 keeps select id from articles where id in (select id from articles where match(title, content) against('+database' in boolean mode)) order by id tagged with @bvt:issue#25891, but issue #25891 ('MATCH in an IN subquery is not rewritten to fulltext_index_scan') was closed as completed on 2026-08-20, and its fix commit 7108f9a (#26965, 'fix(plan): rewrite fulltext match in IN subqueries', merged 2026-08-11) is an ancestor of this PR's HEAD (the branch last merged main 428ce80 on 2026-08-26; git merge-base --is-ancestor 7108f9ab5a HEAD succeeds). mo-tester does not execute statements inside @bvt:issue blocks at all (mo-tester COMMON.java: 'bvt:issue tag will be not executed'), so this block contributes zero coverage and would silently miss a future regression of a shape the PR claims to cover. Additionally, #26965 already added test/distributed/cases/fulltext/fulltext_subquery.sql, which actively asserts this exact shape (same fixture data) with positive output and no issue tag, so the block here is also redundant. The PR's own comment ('remove the tags and add positive output after optimizer support lands') is already actionable at HEAD, and the PR description's 'retain unsupported query shapes as standard issue-tagged expected failures' no longer describes this shape. Suggested fix: delete the tagged block (covered by fulltext_subquery.sql) or drop the tags and assert the positive output (ids 1, 3, 4). Non-blocking: test-only change, no runtime impact, and the shape remains covered elsewhere.

@Ariznawlll

Copy link
Copy Markdown
Collaborator Author

Addressed the stale issue-tag feedback in 46ece64343:

  • Removed the duplicate #25891 issue-tagged query and its placeholder result from fulltext_query_shapes.
  • Kept the still-open #25890 coverage unchanged.
  • The exact #25891 query shape remains active in fulltext_subquery.sql, and its optimizer fix is already an ancestor of this branch.

Validation:

  • mo-tester -c SQL/result contract check passed.
  • go test ./pkg/monlp/tokenizer -run 'Jieba' -count=1 passed.
  • Independent diff review found no remaining issues.

@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 46ece64: one blocking test-quality issue.

P2 (blocking) — remove the newly skipped #25890 case in test/distributed/cases/fulltext/fulltext_query_shapes.sql:61-67 and its placeholder result.

The exact-head PROXY BVT log proves this file ran 14 statements with 13 successful and 1 ignored. The ignored statement is precisely this new @bvt:issue block: with the normal -g mode, mo-tester does not execute it at all. Therefore it adds no regression oracle, cannot verify the current failure mode, and will not tell us when the behavior starts working. Issue #25890 already contains the deterministic reproduction and explicitly asks for an active regression when the optimizer is fixed.

Please remove this skipped block and placeholder from this coverage PR, then add an executable positive assertion in the fix PR for #25890. New behavioral coverage should not be delivered as permanently ignored SQL.

I reviewed all four added files and traced the active assertions to the tokenizer/index implementation. The remaining 51 executed assertions are deterministic and consistent with current semantics; exact-head CI selected both new files and passed them (fulltext_query_shapes: 13/13 executed, 1 ignored; gojieba_precise: 38/38), with about 0.84s combined runtime. I found no other blocker.

@aptend aptend 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-reviewed exact head 46ece64343caf35d2e84abb87eacaba7e51c8984 and the complete four-file diff from merge-base b0ae66c04d9a67175d2dfb8bf1c777fb888e1430, including all review history and the latest incremental fix.

The earlier determinism concern is closed by ordering DocLen last and tokens by byte position. The stale #25891 issue-tagged block is now removed; that exact IN-subquery shape remains actively covered by fulltext_subquery.sql. The remaining #25890 block corresponds to the still-open DISTINCT + ORDER BY rewrite bug and is correctly the sole expected skip. I checked the precise assertions against the tokenizer/table-function contracts: UTF-8 byte positions, lowercase/punctuation handling, UTF-8-safe 23-byte cap, dictionary-only HMM-disabled segmentation, per-token DocLen, nullable content handling, and the newline boundary between indexed columns all align.

Exact-head CI directly executed both new BVTs: gojieba_precise.sql passed 38/38 with no skips, while fulltext_query_shapes.sql passed 13 active statements with only the #25890 block skipped. Local validation also passed mo-tester SQL/result contract checking, git diff --check, focused FullText/Jieba tests for tokenizer, table-function, and planner packages, plus race-enabled Jieba and FullTextTokenize tests. I found no blocking issue.

@Ariznawlll

Copy link
Copy Markdown
Collaborator Author

Addressed the requested change in f5a97183e2:

Validation:

  • Focused mo-tester -c SQL/result contract check passed.
  • go test ./pkg/monlp/tokenizer -run Jieba -count=1 passed.
  • git diff --check passed.

@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-reviewed exact head f5a9718 against base b0ae66c and the complete four-file BVT diff plus review history. The prior blocker is closed: both newly skipped issue blocks are gone, so every retained case is active coverage. Verified the expected GoJieba contracts for UTF-8 byte offsets, DocLen, lowercase/punctuation handling, UTF-8-safe 23-byte truncation, HMM-disabled segmentation, multi-column newline boundaries, NULL/empty indexed values, duplicate/cross-document negatives, non-indexed updates, and truncate/reinsert lifecycle. Query-shape results are deterministic via explicit ordering or valid sort keys; fixtures are minimal, self-contained, sleep-free, and cleaned up. Exact-head CI is green and prior exact selection evidence directly exercised both files. No blocking test-quality, correctness, isolation, or runtime-cost issue remains.

@mergify

mergify Bot commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

Queued — the merge queue status continues in this comment ↓.

@mergify

mergify Bot commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-08-29 02:38 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ✅ Checks skipped · PR is already up-to-date
  • ✅ Merged — 2026-08-29 02:38 UTC · at 9109023b6e6b8a09f0576bd177227c80e2e79afa · squash

This pull request spent 14 seconds in the queue, including 1 second running CI.

Required conditions to merge
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • github-review-approved [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / SCA Test on Linux/arm64
    • check-neutral = Matrixone CI / SCA Test on Linux/arm64
    • check-skipped = Matrixone CI / SCA Test on Linux/arm64
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Utils CI / Coverage
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-neutral = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-skipped = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-neutral = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)

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/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants