Skip to content

fix(function): complete binary string semantics - #28055

Merged
XuPeng-SH merged 42 commits into
matrixorigin:mainfrom
ck89119:issue-27216-main
Sep 9, 2026
Merged

XuPeng-SH merged 42 commits into
matrixorigin:mainfrom
ck89119:issue-27216-main

Conversation

@ck89119

@ck89119 ck89119 commented Sep 3, 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:

issue #27216

What this PR does / why we need it:

  • Makes ordinary string functions select text or byte semantics from the designated subject instead of auxiliary arguments.
  • Preserves per-row binary-string provenance through subject-derived and contributing-value results, including mixed vectors, masks, NULLs, and invalid UTF-8 payloads.
  • Derives CHARSET() and COLLATION() from static expression types and aligns existing charset identities with protocol and information_schema metadata.
  • Preserves binary-string domains across user variables, SQL PREPARE, COM_STMT packet types, distributed process metadata, migration, and prepared-plan cache reuse.
  • Adds mixed-version fail-closed barriers for remote pipelines that execute the affected functions. Current mo/main ends at v47, and this complete capability uses the contiguous MORPCVersion48.
  • Adds focused unit tests and BVT coverage for value semantics, result domains, prepared execution, CTAS, metadata, migration, and upgrade behavior.

Review follow-up

The seven review areas are addressed:

  1. Removed the reported unused legacy helpers.
  2. Appended immutable v4.0.6 upgrade entries for the COLUMNS view and CHARACTER_SETS data; corrected public utf8.MAXLEN to 3.
  3. Added sender- and receiver-side MORPC v45 checks for affected remote pipelines.
  4. Preserved SQL PREPARE and COM_STMT binary types for typed NULL parameters and metadata specialization.
  5. Carried the three-state runtime string domain through user-variable assignment, lookup, SELECT INTO, prepared SET/EXECUTE USING, and migration metadata; unsupported older peers fail closed.
  6. Validated LIKE ... ESCAPE by effective row domain: one arbitrary byte for binary rows and one valid rune for text rows.
  7. Added terminal-suffix and raw-literal-run fast paths to avoid adversarial %...literal byte-LIKE backtracking.

Testing

The detailed follow-up sections below contain the latest validation and supersede this original test snapshot:

  • NATIVE_BUILD_JOBS=8 make build
  • Owning-package CGo tests passed for pkg/bootstrap/versions/v4_0_6, pkg/frontend, pkg/sql/colexec, pkg/sql/compile, pkg/sql/plan, pkg/sql/plan/function, pkg/util/sysview, and pkg/vm/process
  • Focused golangci-lint for the owning packages with the repository CGo flags: 0 issues
  • binary_string_function_semantics.test on a freshly initialized instance, twice consecutively: 49/49 each run
  • git diff --check and exact conflict-marker scan
  • Earlier full changed-statement coverage measurement: 80.15% (646/806)

Reviewer note: repository cleanup

This PR also deletes CLAUDE_TODO_2026-08-29.md and CLAUDE_TODO_2026-08-30.md. These internal planning files were accidentally committed by earlier work and are already present on main; their deletion here is intentional repository cleanup and is unrelated to the binary-string behavior change. No production or test logic is removed by this cleanup.

Second P1 review follow-up

  • SQL EXECUTE ... USING now installs RuntimeStringDomain on typed non-NULL literals before the materialization fast-path returns. Bidirectional tests execute CHAR_LENGTH: static VARBINARY/runtime text returns 2, while static VARCHAR/runtime binary returns 4, with repeated materialization from the same prepared plan.
  • COM_STMT direct-result specialization now uses the direct-result position and packet-derived runtime type instead of conversion kind/non-NULL state. A BLOB typed NULL specializes to T_blob on the first execution and remains T_blob when the previous packet type and runtime compile cache are reused.
  • The MORPC v45 barrier now also covers POSITION, INTERNAL_CHAR_SIZE, and INTERNAL_COLUMN_CHARACTER_SET. All 28 changed Function IDs have table-driven tests through the real encodeRemoteScope sender and remote decodeScope receiver boundaries: v44 rejects and v45 accepts each ID.
  • Binary LIKE adds a linear fast path for % followed by _ runs and a literal segment, plus a fixed 16M-step budget for the remaining general backtracking fallback. The reported adversarial benchmark is now approximately 4.9/10.2/20.8 µs at n=2000/4000/8000 (about 2x per doubling, zero allocations), and an unoptimized fallback rejection case verifies the bound.
  • Round-two changed-statement coverage: 77.55% (38/49). Owning-package tests, build, focused lint (0 issues), and two fresh-instance BVT runs (49/49 each) pass.

Third P1 review follow-up

  • Removed the fixed 16M binary-LIKE backtracking budget and its SQL error. General wildcard patterns now use a semantics-complete bit-parallel NFA that never backtracks or rejects a valid match. Its bounds are O(valueBytes * ceil(patternTokens/64)) time and O(distinctLiteralBytes * ceil(patternTokens/64)) space.
  • Added the reported late-alignment case (about 9KB value / 5KB pattern) as both a focused UT and public BVT; it returns 1, matching MySQL 8.4. A deterministic exhaustive test compares all short a/b values and a/b/_/% patterns against an independent dynamic-programming oracle.
  • Moved the MORPC v45 capability check before pipelineContainsFunction, so steady-state peers do not reflectively scan the pipeline. A 1000-expression Projection benchmark is approximately 27 ns/op, 0 B/op, 0 allocs/op, with a zero-allocation UT.
  • Round-three changed-statement coverage is 98.59% (70/71). Owning-package tests, build, focused lint (0 issues), and two fresh-instance BVT runs (50/50 each) pass.

Fourth P1 review follow-up

  • Removed the bit-parallel NFA and all dense per-literal-byte masks. Binary glob patterns are compiled into a compact token stream and split at %; anchored prefix/suffix segments are checked directly, and intermediate fixed-length segments use their longest literal run as a bytes.Index/Two-Way search anchor while advancing a monotonic value cursor.
  • Compiled storage is at most two bytes per normalized pattern token, allocated off-heap through the process MPool. Admission failures propagate through the LIKE executor and all failure/success paths release the buffer.
  • Constant patterns compile once per batch. Dynamic rows reset and reuse the same compiled storage capacity.
  • The reported late-alignment benchmark now scales approximately 1.5/3.0/5.9/11.7/23.3/46.8 µs for 2K/4K/8K/16K/32K/64K, with 0 B/op and 0 allocs/op in the match phase.
  • Added independent DP-oracle coverage, the public late-alignment BVT, 64KB constant-pattern × 8-row reuse coverage, linear-storage checks with all byte values, scratch pointer reuse, and MPool allocation-failure propagation.
  • After merging current mo/main: owning function-package tests, build, focused lint (0 issues), 96.15% round-four changed-statement coverage (125/130), and two BVT runs (50/50 each) pass.

Repeated-anchor P1 follow-up

  • Replaced first-longest-run selection with one value-frequency pass plus a rarest-literal-run anchor choice; equal-frequency anchors prefer the longer and later run. Segment constraint verification now proceeds from both ends.
  • Added the exact reported %a + _... + b% / all-a regression test and a 2K–64K benchmark.
  • The reported match-only case now measures approximately 5.2/10.4/21.0/42.2/85.3/170.7 µs instead of 0.49/1.95/7.79/30.8/123 ms. Doubling the input is approximately 2x, with 0 B/op and 0 allocs/op.
  • Independent exhaustive DP-oracle tests and the complete function package pass. This follow-up has 100% changed-statement coverage (25/25), focused lint reports zero issues, make build passes, and the public BVT passes 50/50 on a fresh instance.

Conflict resolution and CI follow-up

  • Merged current mo/main (bf63172c06) and resolved the two conflicts by preserving both the Parquet whole-file-fanout and binary-string sender/receiver protocol validators.
  • MORPCVersion45 is now owned by main's Parquet fanout, while concurrent PR fix: expose subscription tables in information schema #27942 reserves v46. This PR therefore moves the binary-string execution/migration/upgrade barrier to MORPCVersion47, with v46-reject/v47-accept coverage.
  • The previous Coverage failure was downstream of two failed BVT producers. Their actionable failures were stale expected results introduced by this PR: MySQL-order ORD bytes, byte-oriented BLOB slicing (including preserved trailing bytes), and RPAD(..., '') returning NULL. Updated those three result files.
  • Validation after the merge: full pkg/sql/compile, pkg/frontend, pkg/bootstrap/versions/v4_0_6, and pkg/sql/plan/function tests pass; focused lint reports 0 issues; make build passes. The exact charset (158/158), INSTR (91/91), binary-string (50/50) BVT files pass. The target text_blob row 86 also passes; three unrelated local external-file rows cannot run in this workstation launch because its external resource file resolves empty (the prior CI run populated it and only failed row 86).

Fifth P1 review follow-up

This section supersedes the earlier protocol-version, binary-LIKE algorithm, and empty-pad statements above.

  • Merged current mo/main (494e6a7723). Main still ends at MORPC v45 and fix: expose subscription tables in information schema #27942 remains open, so this PR now publishes the complete binary-string capability as the contiguous MORPCVersion46; remote execution, migration, and catalog upgrades reject v45 and accept v46. There is no v47 declaration or dependency on unmerged work.
  • Restored MySQL-compatible LPAD/RPAD behavior for empty pads: expansion returns a non-NULL empty string, while a target no longer than the source still truncates normally. Text and binary executor UTs and BVT expectations cover both directions.
  • Replaced the unbounded wildcard-segment anchor path with an adaptive exact matcher. Low-work anchor verification is capped; high-work _ segments use deterministic two-modulus NTT convolution in segment-sized candidate blocks. The modulus product exceeds the maximum mismatch polynomial for a 64 MiB segment, so this is exact rather than probabilistic. Failed blocks consume disjoint value ranges, giving the complete matcher O((value + pattern) log pattern) worst-case time for the supported BLOB range.
  • Compiled tokens and convolution scratch are process-MPool-backed, allocation failures propagate without leaks, and scratch is reused across dynamic resets and constant-pattern batch rows. Tests include an independent convolution oracle, a deliberate first-modulus collision, block-size bounds, executor admission failure/no-leak, and the reported equal-frequency adversary as UT/BVT.
  • Equal-frequency scaling for L=1K/2K/4K/8K/16K/32K (pattern approximately 2L, reaching about 64 KiB) is 1.82/3.77/8.11/17.64/38.32/82.00 ms, with 0 B/op and 0 allocs/op after scratch warm-up. The existing repeated-anchor and late-alignment 2K–64K paths remain linear and allocation-free.
  • Post-merge validation: all tests pass for pkg/sql/plan/function, pkg/sql/compile, pkg/frontend, and pkg/bootstrap/versions/v4_0_6; changed-statement coverage is 95.95% (142/148); focused lint reports 0 issues; make build passes; fresh-instance BVT passes binary_string_function_semantics 52/52 and function_instr 91/91.

Sixth review follow-up

  • Binary LIKE now computes the direct-verification upper bound from min(anchorFrequency, candidateCount) and only selects convolution when that work exceeds 64 * (valueLength + segmentLength). A one-alignment segment therefore always stays on the direct path, independent of segment size.
  • Added the reported roughly-64-KiB one-candidate case, an eight-row constant-pattern executor case, and a MaxBlobLen decision guard. They allocate no convolution scratch; the batch performs only the one compiled-token allocation.
  • Single-candidate benchmarks at 64 KiB, 1 MiB, and nearly 64 MiB take 0.253/3.847/247.224 ms respectively on the M1 Pro, with 0 B/op, 0 allocs/op, and zero NTT scratch. The equal-frequency multi-candidate benchmark still selects convolution and retains its n log n scaling.
  • NTT work now carries the process context and periodically checks cancellation in fill, transform, accumulation, and candidate loops. A pre-canceled query exits before scratch allocation.
  • Empty-pad LPAD/RPAD sizing now checks the result limit first for both text and binary domains. In-range expansion remains a non-NULL empty string, but target 67,108,865 returns NULL. UT and public BVT cover LPAD/RPAD in both domains.
  • Corrected the exactness proof to use p*x*(p-x)^2, whose maximum per-byte term is 636,284,160. The 64-MiB aggregate bound remains below the two-modulus product. The dual-modulus test now uses [244 x 8, 157] versus [56 x 8, 78], asserts a zero first residue and nonzero second residue, and verifies rejection by the second modulus.
  • Merged current mo/main (149219181f). Full function-package tests, make build, focused lint (0 issues), 78.26% follow-up changed-statement coverage (36/46), and BVT (53/53 binary-string semantics; 91/91 INSTR) pass.

Seventh review follow-up

This section supersedes the Sixth follow-up for multi-segment direct verification and empty-pad character limits.

  • Binary LIKE now maintains one 64 * (valueLength + patternLength) direct-verification budget for the complete match. Every actually inspected constraint consumes it; it is never reset per % segment. If it is exhausted, matching resumes from the current unresolved candidate with the exact two-modulus convolution path rather than returning an error.
  • Sparse wildcard segments no longer rescan long _ runs for every candidate. For a multi-candidate segment whose literal density is at most 1/8, reusable process-MPool scratch stores only literal offsets, so direct verification checks exactly those constraints. Single-candidate segments retain the zero-scratch direct path. MPool admission-failure and no-leak tests cover this new scratch.
  • Pattern compilation, frequency and anchor scans, direct candidate verification, sparse verification, and NTT loops periodically check the process context. A deterministic mid-match cancellation test proves that a query already executing in the direct path returns context.Canceled without timing or sleep dependencies.
  • The scaled different-rarest-byte reproducer now takes approximately 0.34/1.30/5.30/16.13 ms for 16x4K, 32x8K, 64x16K, and 96x32K segments on the M1 Pro, with 0 B/op and 0 allocs/op after warm-up and no NTT scratch. A MaxBlobLen arithmetic guard proves that the original per-segment work exceeds the match-wide budget, while a forced-budget test verifies exact fallback from an unresolved candidate. Dense equal-frequency cases still use convolution and retain n log n scaling.
  • Text LPAD/RPAD now applies a charset-aware character bound before the empty-pad shortcut. utf8mb4 accepts target 16,777,216 and returns a non-NULL empty string, but target 16,777,217 returns NULL, matching MySQL's 64-MiB / 4-byte boundary. Binary input at 16,777,217 remains in range; legacy utf8 uses its 3-byte bound.
  • Merged current mo/main (922e792ebf); fix: expose subscription tables in information schema #27942 remains open and MORPC v46 remains contiguous. Post-merge full function-package tests and make build pass. Focused lint reports 0 issues, follow-up changed-statement coverage is 87.18% (102/117), and fresh-instance binary_string_function_semantics BVT passes 54/54.

Eighth follow-up: latest-main conflict resolution

This section supersedes all earlier protocol-version statements.

  • Merged current mo/main (e7bb057223) and resolved all four textual conflicts. Main's subscription-aware TABLES/COLUMNS definitions and this PR's charset/collation mappings are both preserved in the combined view SQL and BVT expectations.
  • PR fix: expose subscription tables in information schema #27942 is now merged and owns MORPC v46; main's window hash-partition capability owns v47. Binary-string semantics therefore move to the next contiguous MORPCVersion48. Remote sender/receiver validation and user-variable migration reject v47 and accept v48.
  • Every historical tenant-upgrade entry that materializes the current InformationSchemaColumnsDDL now requires v48, while TABLES remains at main's v46. This prevents older v46/v47 CNs from materializing a combined COLUMNS view whose internal functions require the binary-string capability.
  • The merged SHOW CREATE information_schema.columns output retains subscription metadata and all existing utf8, utf8mb4, and binary mappings. The conflict rows use the verified combined DDL metadata length of 10,118.
  • Full tests pass for pkg/sql/compile, pkg/frontend, pkg/sql/plan/function, and the affected v1.2.0/v2.0.0/v2.0.2/v2.1.0/v4.0.0/v4.0.5/v4.0.6 bootstrap packages. Focused lint reports 0 issues; make build, the binary-string BVT (54/54), and account_restricted (125/125 executed cases) pass.

Ninth review follow-up

  • New-tenant information-schema initialization now has three explicit COLUMNS definitions: v41 uses local catalog columns with legacy identities; v46/v47 uses subscription columns with legacy identities; v48 uses subscription columns with the new utf8/utf8mb4/binary identities. Protocol-layer tests parse and validate each tier. This closes the initialization path that bypassed tenant-upgrade gates.
  • Text LPAD/RPAD no longer applies maxBytes / charsetWidth as an absolute target-character limit. Truncation is admitted from the actual retained prefix bytes. Expansion is checked overflow-safely as sourceBytes + missingRunes * charsetMaxWidth before the empty-pad result is selected. Tests cover utf8mb4 source-length-sensitive target 16,777,217, truncation from 17,000,000 characters, and the utf8mb3 22,369,622 boundary.
  • Binary LIKE now checks the process context immediately after every bytes.Index call, so cancellation that occurs during either a successful or unsuccessful scan is returned as context.Canceled. Deterministic tests cover both outcomes.
  • A zero-frequency rarest anchor now returns mismatch before sparse-position or convolution scratch allocation. The reported 1-MiB sparse-pattern / 2.4-MiB MPool shape succeeds as a normal mismatch without leaking or raising an allocation error.
  • Full function and sysview package tests pass; follow-up changed-statement coverage is 100% (12/12); focused lint reports 0 issues; make build and the binary-string BVT (55/55) pass. The multi-segment benchmark remains allocation-free at approximately 0.33/1.30/5.12/15.34 ms for the existing four scales.

Tenth review follow-up

  • The v41 and v46 compatibility COLUMNS definitions now also map identity 3, emitted by a new CN for ordinary text, to the legacy utf8 / utf8_bin presentation. The v48 definition still maps identity 3 to utf8mb4 / utf8mb4_general_ci. Protocol-tier tests validate both compatibility definitions and parse every generated initialization statement.
  • Binary LIKE now decrements literal frequencies for every consumed [oldCursor, newCursor) range. The frequency table therefore remains exact for each subsequent segment; every value byte is decremented at most once, and the new linear loop retains periodic cancellation checks.
  • A 1-MiB sparse multi-segment regression consumes the only anchor in its first segment and then runs under a 2.4-MiB MPool. It now returns false, nil without sparse/convolution scratch allocation or leakage.
  • A real 32 x 8192 dense multi-segment compiled.match regression verifies that every segment remains below its local convolution threshold, then exhausts the shared match-wide direct budget and observes convolution scratch. This closes the previous test gap where fallback was only forced through a manually zeroed budget.
  • Full function and sysview package tests pass; follow-up changed-statement coverage is 100% (9/9); focused lint reports 0 issues; make build and the binary-string BVT (55/55) pass. Existing direct and equal-frequency benchmark scales remain at 0 B/op, 0 allocs/op.

Eleventh review follow-up

  • The final LIKE segment no longer performs consumed-range literal-frequency maintenance. Frequency is now updated only after skipping % when another segment remains, removing the extra full scan from the single-long-segment hot path.
  • The cancellation regression now uses %a%b%, so cancellation is exercised during frequency maintenance that is required for the next segment rather than during an otherwise unnecessary final-segment scan.
  • Merged the latest mo/main and resolved conflicts while preserving binary-string MORPC v48 plus the newer v49 grouping-set capability, all remote validators, and the combined upgrade-test expectations.
  • Focused function and sysview tests pass after the merge; working tree is clean.

Twelfth review follow-up

  • Corrected the MORPC allocation: v48 remains the main branch CDC generation-aware watermark capability, v49 remains grouping-set projection, and binary-string semantics/runtime-domain metadata now use the new v50 capability. MORPCLatestVersion is v50.
  • Updated only binary-string-specific sender/receiver validation, user-variable migration, COLUMNS initialization, historical COLUMNS/CHARACTER_SETS upgrade entries, and their tests to v50. CDC v48 gates and grouping-set v49 gates remain unchanged.
  • Added/updated protocol regressions so v49 rejects binary-string pipelines and v50 accepts them. COLUMNS compatibility definitions remain selected through v49; the new identity definition is selected from v50.
  • Merged and resolved conflicts with mo/main@109bf926f while preserving the main branch's v48/v49 capability assignments.
  • Focused compile/frontend/sysview/function and related bootstrap tests pass; lint reports 0 issues; make build and binary-string BVT 55/55 pass.

Thirteenth review follow-up

  • Added PrepareParamInfo.runtime_string_domains (protobuf field 8) and regenerated pipeline.pb.go.
  • ProcessInfo encode/decode and remoterunServer now preserve explicit Inherit, Text, and Binary runtime domains. NULL rows remain Inherit and are safely ignored by the vector domain setter.
  • Added length, enum, protocol, and ProcessInfo roundtrip validation. Explicit runtime-domain metadata requires v50; older peers fail closed rather than treating an omitted field as explicit text.
  • Renamed informationSchemaColumnsV48DDL to informationSchemaColumnsV50DDL.
  • Process, compile, frontend, and sysview tests pass; lint reports 0 issues; make build and binary-string BVT 55/55 pass.

Conflict resolution follow-up

  • Merged latest mo/main through a6ee717132 and resolved all conflicts.
  • Main now allocates v50/v51 to ordered ODKU capabilities, so binary-string ProcessInfo/runtime-domain capability was moved from v50 to v52; MORPCLatestVersion is v52.
  • Preserved main's CDC v48 and grouping-set v49 capabilities, plus the newer ODKU v50/v51 gates and generated protobuf changes.
  • Updated binary-string gates, ProcessInfo metadata validation, COLUMNS initialization, upgrade entries, tests, and documentation consistently to v52.
  • Merge commit: 21ba69fb8f; working tree is clean.

# Conflicts:
#	pkg/bootstrap/versions/v4_0_6/upgrade_test.go
#	pkg/defines/const.go
#	test/distributed/cases/dml/show/show.result
#	test/distributed/cases/zz_accesscontrol/account_restricted.result
# Conflicts:
#	pkg/bootstrap/versions/v4_0_6/upgrade_test.go
#	pkg/defines/const.go
#	pkg/sql/compile/remoterun.go
# Conflicts:
#	pkg/defines/const.go
#	pkg/pb/pipeline/pipeline.pb.go
#	test/distributed/cases/database/system_table.result
# Conflicts:
#	pkg/defines/const.go
#	pkg/frontend/back_exec.go
#	pkg/frontend/compiler_context.go
#	pkg/frontend/computation_wrapper.go
#	pkg/frontend/computation_wrapper_test.go
#	pkg/frontend/mysql_cmd_executor.go
#	pkg/sql/colexec/evalExpression.go
#	pkg/sql/plan/function/func_builtin_regexp.go
#	pkg/sql/plan/function/func_unary.go
#	pkg/sql/plan/function/type_check.go
#	pkg/sql/plan/utils.go
# Conflicts:
#	pkg/defines/const.go
#	pkg/pb/pipeline/pipeline.pb.go
# Conflicts:
#	pkg/defines/const.go
#	pkg/pb/query/query.pb.go

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

Reviewed head 080388b. Request changes for an unrelated protocol regression.

[P1] Preserve the already-shipped v53 ordered Top-N capability

pkg/sql/compile/compile.go:7344 changes supportsDistributedOrderedTop from MORPCVersion53 to MORPCVersion55, although pkg/defines/const.go still correctly assigns ordered-stream Top-N to v53 and only the new binary-string semantics to v55. This is not just a conservative planner fallback: the same helper is called by validateRemoteDistributedOrderedTopPipelineProtocol in remoterun.go. During an upgrade with negotiated v53/v54, an older coordinator can legitimately send an ordered Top-N pipeline, but a receiver containing this change now rejects it with the contradictory error "requires MORPC protocol version 53". New coordinators also lose the existing optimization at those versions.

Fix: restore this existing capability predicate to v53; keep the new binary-string/runtime-domain predicates independently gated at the new version. Add explicit v52/v53/v54/v55 sender and receiver tests: reject ordered Top-N at v52, accept at v53 and above, while rejecting the new binary-string protocol below its own gate. Do not test only MORPCLatestVersion: the existing compile matrix uses v52/latest and therefore misses this regression when latest advances.

Review scope/evidence: inspected the complete change map and function-semantics design, then followed protocol metadata validation/ownership and all callers of the changed Top-N capability. The failure above follows directly from the receiver predicate and the existing v53 wire contract; I did not run a fresh native two-CN reproduction or claim a complete approval of the large LIKE/NTT implementation. The binary metadata length/domain validation and separate fail-closed gates should be preserved. After fixing the capability regression, retain the PR's staged readiness holds and provide mixed-version receiver coverage before requesting re-review.

# Conflicts:
#	pkg/defines/const.go
#	pkg/frontend/computation_wrapper.go
#	pkg/frontend/computation_wrapper_test.go
#	pkg/frontend/types.go
#	pkg/pb/pipeline/pipeline.pb.go
# Conflicts:
#	pkg/frontend/computation_wrapper_test.go
Keep historical COLUMNS DDL and v46 gates; install new semantics only through v4.0.6. Reserve v57 for main's Arrow LOAD and gate binary-string/runtime-domain capabilities at v58. Restore empty DESC Comment fields and refresh bounded HEX result metadata.
@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 90d773819692f16f61b08eabcecbafb53c565c16 (base 93e7a3c631e31e28b85714840279d7c20424693f).

Request changes: one confirmed P2 wrong-result blocker, detailed inline. The new domain-preserving resolver/executors are not closed over the existing exact BINARY/VARBINARY SUBSTRING overloads.

The previous requested-change blocker is closed: distributed ordered Top remains independently gated at v53; this feature uses v58. Reviewed the complete 81-file change map, approved design, function resolution and row-domain propagation, SQL/COM prepared values and transport/migration, sender/receiver capability checks, immutable historical catalog DDL versus appended v58 entries, LIKE direct/sparse/convolution paths and their accounting/cancellation, and UT/BVT changes. REGEXP full semantics remains explicitly owned by #27217; no claim that this PR implements it.

Validation: exact-head CI run 34314820610 succeeded, including UT and BVT jobs (upgrade was skipped, not counted as evidence). Independently rebuilt native dependencies in an isolated exact-head worktree and ran a new resolver-to-executor counterexample with .agents/skills/mo-dev/scripts/mo-cgo-test -p 4 -v -count=1 -timeout=120s -run '^TestAstraReviewSubstringAfterLeftTextOverride$' ./pkg/sql/plan/function: it failed deterministically, expected E5A5BD, actual BD. This was a typed executor test, not a claimed live SQL/BVT run. No other confirmed blockers from the reviewed scope; no production changes made.

Comment thread pkg/sql/plan/function/list_builtIn.go Resolved

@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 re-review of exact head c3d832e: the previous SUBSTRING wrong-result blocker is closed; no additional confirmed blocker found.

All four exact BINARY/VARBINARY registrations now dispatch to the existing domain-aware two-/three-argument executors. This preserves byte slicing for effective binary rows while honoring explicit Text overrides and propagating selected-result domains. Rechecked mixed vectors, NULL/masked rows, zero/negative/extreme offsets and lengths, result types, and the unchanged overflow-safe bounds helper. The binary fast path still slices bytes directly; this fix introduces no shared mutable state or new unbounded allocation path. REGEXP full semantics remains the explicitly separate scope of #27217.

Coverage/evidence: mapped all 82 current PR files against the prior complete review at 90d7738. Only four files differ, and all four were reviewed; prior design/protocol/planner/runtime-domain/LIKE/unhappy-path evidence is reused for unchanged code. Independently replayed the previously failing LEFT→SUBSTRING resolver/executor counterexample and the new TestSubstringExactBinaryRuntimeDomain matrix with repository-native CGo dependencies: both pass (including BINARY/VARBINARY × two/three arguments, mixed Text/Binary rows, NULL and selection masks). The three exercised implementation/test files match current-head Git blob hashes. This was the existing isolated native worktree with the exact four-line fix and exact new UT applied, not a claim of rebuilding the whole rebased head. Original counterexample now returns E5A5BD for the text row and BD for the binary row.

Exact-head CI run 34325129573 is successful for UT, coverage, shared build and compose/proxy BVT; the public SQL regression and expected output were also inspected. No fresh live SQL, mixed-version cluster run or performance benchmark was performed by this reviewer. No production workspace changes were made.

@mergify

mergify Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-09-09 10:20 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🟠 Checks running · in-place
  • 🚫 Left the queue — 2026-09-09 10:23 UTC · at e34dce6e27046836fa420141ad37670530d27345

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

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

Reason

Pull request #28055 has been dequeued

Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.

The author needs to enable "Allow edits from maintainers" on this pull request.

Hint

You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it.
If you do update this pull request, it will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue instead, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

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

  • Requeue this pull request

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 size/L Denotes a PR that changes [500,999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants