Skip to content

fix(function): support large SPACE results - #30207

Merged
XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
iamlinjunhong:fix/space-result-length-30186
Oct 14, 2026
Merged

XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
iamlinjunhong:fix/space-result-length-30186

Conversation

@iamlinjunhong

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:

What this PR does / why we need it:

SPACE(65536) and SPACE(100000) failed because SPACE used VARCHAR's 65,535-character column limit as its generated-result limit. Allow results up to MatrixOne's existing 64 MiB large-string bound and declare LONGTEXT results for all five existing overloads so protocol metadata and materialized results can represent them.

Keep existing integer conversion, decimal rounding, NULL/negative-count behavior, and overload IDs. Counts above 64 MiB still fail before allocation. Execution retains the same linear algorithm and existing vector ownership; memory grows with the requested output within this finite bound.

Validation on Go 1.27.1, macOS arm64, with locally built native libraries:

  • Reproduced the original literal, column and SQL PREPARE failures through the real MySQL frontend; REPEAT/LPAD/RPAD controls succeeded.
  • Focused SPACE boundary/content/overflow/decimal/NULL/mask/return-type tests and the full function package passed.
  • MySQL-protocol regression passed: actual 100,000-space output and LONGTEXT metadata, CTAS, column inputs, SQL/binary prepared reuse, and recovery after an oversized result. Local frontend test binaries used -w to omit debug information.
  • Normal mo-tester comparison passed twice on the same isolated cluster: func_string_space 70/70, func_string_length 55/55, func_string_rtrim_ltrim 154/154, and dtype/text_blob 143/143. Verified each test database was removed before the next run.
  • Formatting, default vet and incremental golangci-lint passed for both changed Go packages. The pinned repository linter reported only two unchanged unsafe-import diagnostics, reproduced with a clean-base overlay.

CI is pending. Please leave #30186 open for the reporter to verify after merge.

@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 commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-local · done

Commit: 8cd351768615823e9b579a5d213172f5a5815365

Review completed. Read the assessment.

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

mo-bot review · mo-bot-local · review

Commit: 8cd351768615823e9b579a5d213172f5a5815365

Assessment: approve

Reviewed the complete ten-file delta and affected callers; no actionable findings remain. The design coherently separates SPACE’s generated-result bound from VARCHAR column capacity, preserves overload compatibility, and reuses existing conversion, execution and cleanup owners. LONGTEXT metadata supports materialization without allocating its declared capacity.

Model: gpt-6-astra / xhigh

Session: 01a12d8f-8e48-7622-ad17-b605f08450ce · slot 1 · generation 0

Validation:

  • Isolation preflight passed. Verified 192 native inputs and 46 artifact hashes against the repository build owner’s successful receipt.

  • Full pkg/sql/plan/function tests passed, including the 64 MiB boundary, overflow rejection, decimal rounding and NULL/masked rows. Seven unrelated ONNX tests skipped.

  • TestIssue28395And28400StringIntegerConversions passed through the real frontend: 100,000-byte output, LONGTEXT metadata, CTAS, column inputs, SQL/binary prepared reuse and recovery after overflow.

  • Reconciled commands, clean-head fingerprints, exit receipts and retained logs in /home/xupeng/.local/state/mo-bot/jobs/c4f44ab26faa3dcac0eaf44b/attempt-1/validation-audit.json. Final audit and git diff --check passed.

  • Frozen exact-head CI reports successful Ubuntu unit tests and proxy/pessimistic BVT runs.

Limitations:

  • Full BVT suites were not rerun locally; the supplied CI snapshot lacks per-case logs. Author test summaries were not treated as independently verified execution.

  • Standalone issue #30186 text was absent; its reported SPACE behavior was assessed from the frozen PR body.

  • No performance benchmark was run. Larger outputs retain linear CPU/memory costs; wider metadata can affect planner estimates.

@mergify mergify Bot added the queued label Oct 14, 2026
@mergify

mergify Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-14 21:11 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🚫 Left the queue — 2026-10-14 21:56 UTC · at 68b3221e07b7b59275792f7397f932c3f0706320

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

Reason

Pull request #30207 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
ci — 68b3221e Deployed Oct 14, 2026 by mergify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

3 participants