Skip to content

fix(python-sdk): preserve explicit zero SELECT limits - #30825

Merged
XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
MatrixAdventurer:fix/python-select-zero-limit-20261022
Oct 22, 2026
Merged

XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
MatrixAdventurer:fix/python-select-zero-limit-20261022

Conversation

@MatrixAdventurer

@MatrixAdventurer MatrixAdventurer commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

由 LW 授权的 ChatGPT Personal 智能体提交。

What type of PR is this?

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

Which issue(s) this PR fixes:

Related to #30824. No automatic issue closure is requested.

What this PR does / why we need it:

An explicit build_select_query(..., limit=0) silently omits LIMIT and returns an unrestricted query. Test for None instead of truthiness, matching the existing MatrixOneSQLBuilder.limit(0) contract. Default/positive limits, WHERE parameters, ordering and both output modes retain their behavior.

Two files, +26/-1. The regression extends the existing owning test file: actual public-builder SQL executes against a disposable native SQLite DBAPI fixture of three rows, testing absent/zero/one/above-cardinality bounds in both parameter modes. No new dependency, generated source, server semantics or API signature change.

Validation and review

  • Base main: 6cbe375b49696021d72778baa292a66287f080bd; final remote head: e46e614dd1ac84c0aa0384395c434b7dc1aaa9e5. Product tree 733325edcdc0c4c75229b90b46dcd61bb025e201 matches local tested commit 1a9079fde377049992f97129e72fe83312f8c348.
  • Python 3.12.14 / SQLAlchemy 1.4.54. Actual regression against original production: 2 failed / 6 passed (both zero-limit modes returned two rows instead of none). Fixed regression 8 passed, owning file 38 passed.
  • Full SDK offline command: PYTHONPATH=. python -m pytest tests/offline -o addopts='' -q --tb=short: 1268 passed +86 subtests, 3 existing warnings, zero failed/skipped.
  • Fatal Flake8 E9,F63,F7,F82, git diff --check, wheel/sdist build and twine check passed. Build initially lacked setuptools/twine; these were installed in the isolated workspace environment and the actual build/check rerun succeeded.
  • Independent review agent explicitly Approve on the complete two-file delta; independently reproduced the original/fixed public-builder behavior in both modes and ran 8/8 regressions plus 38/38 owning tests.
  • Risk R2, ordinary bug-fix design exemption. No new shared state, resource owner, wait, persistence or protocol implementation. The test closes its in-memory connection in finally. No race/topology testing is indicated by this pure sequential query-generator change.
  • Kernel BVT is not added: this restores client SQL generation, with no changed server SQL contract. SQLite validates generated ordinary SELECT result semantics; no live MatrixOne or full online certification is claimed. Upstream MatrixOne ALL CI #39750941783 completed: all six Python/SQLAlchemy SDK jobs and CI Required succeeded. This includes each job's offline suite and wheel/sdist validation; the configured fatal-Flake8 cell passed. Kernel and online jobs were intentionally path/dispatch-skipped, not claimed passed. PR is ready for review.
  • Authenticated MatrixAdventurer, own-fork parent relationship and push permission were freshly verified. No exact upstream dev exists, so main follows explicit user authorization. Only own-fork feature branch fix/python-select-zero-limit-20261022 was created; no default/upstream branch is written.
  • Issue [Bug]: Python SELECT convenience builder ignores explicit limit=0 #30824 assignment to actual login XuPeng-SH was read back. Branch creation, commit creation, PR creation and read-only verification are performed by the signed execution subject. After required CI succeeded, the PR was marked ready, assigned to XuPeng-SH and review requested from XuPeng-SH; actual metadata is read back in the signed delivery record. No merge, deployment or issue closure.

由 LW 授权的 ChatGPT Personal 智能体提交。

Use the existing builder limit contract: only None omits LIMIT. Cover actual generated SQL execution in both parameter modes with zero, absent and positive limits. Related to matrixorigin#30824.

由 LW 授权的 ChatGPT Personal 智能体提交。
@mergify mergify Bot added kind/bug Something isn't working kind/test-ci labels Oct 22, 2026
@MatrixAdventurer
MatrixAdventurer marked this pull request as ready for review October 22, 2026 08:53
@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 →

Copy link
Copy Markdown
Contributor Author

由 LW 授权的 ChatGPT Personal 智能体提交。

交付固定记录:head e46e614,base main 6cbe375,全产品tree733325edcdc0c4c75229b90b46dcd61bb025e201与本地已测试/独立Approve的tree一致;2文件+26/-1。实际RED 2失败/6通过,GREEN回归8/8、owningfile38/38、全offline1268+86subtests。fatal Flake8、wheel/sdist及Twine通过,打包wheel内容也已核对含修复。

上游正式CI https://github.com/matrixorigin/matrixone/actions/runs/39750941783 的6个SDK矩阵job与CI Required均SUCCESS。已读三组原始日志:Python3.10/SA1.4为1268、3.10/SA2.0为1264、3.11/SA2.1为1272,均+86subtests,wheel/sdist检查通过。其余三组job也已确认terminal SUCCESS。Iceberg adapter module tidy SUCCESS;kernel/BVT/upgrade/full online按路径/dispatch条件SKIPPED,不声称覆盖。

门禁完成后已转ready、assign XuPeng-SH并请求XuPeng-SH审阅;重新读取确认draft=false、PR assignee含XuPeng-SH、requested reviewers含XuPeng-SH(另有自动aptend),正文与待发布内容一致且保留模板/LF。Issue #30824 assignee此前已读回。独立review agent完整审查并独立执行原始/修复和38项owning测试,明确Approve,无阻塞。所有创建fork feature分支/commit/PR、转ready、指派、请求审阅及只读核验均由以上署名主体执行。未推上游/default分支,不合并、不部署、不关闭Issue。

@XuPeng-SH

XuPeng-SH commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: e46e614dd1ac84c0aa0384395c434b7dc1aaa9e5

Review completed. Read the assessment.

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

APPROVE on exact head e46e614dd1ac84c0aa0384395c434b7dc1aaa9e5 (base/merge-base 6cbe375b49696021d72778baa292a66287f080bd).

Reviewed the complete two-file diff, linked issue and full discussion/thread state. Testing limit is not None at this wrapper correctly restores the existing MatrixOneSQLBuilder.limit(0) / _build_select contract. Default None and positive limits retain their paths; WHERE parameters, ordering and both substitution/binding outputs still pass through the same builder. No blocker found.

The regression executes SQL from the actual public builder, with independent row-result expectations for None/0/1/above-cardinality in both modes. Three rows suffice, ordering is deterministic, and the in-memory SQLite connection closes in finally. This is client query-generation proof, not a claim of live MatrixOne certification; no server behavior changed. The ordinary-fix design exemption applies, and no race/native/topology work is indicated.

Reused verified exact-head evidence from CI 39750941783: inspected raw logs for all six Python/SQLAlchemy matrix cells, each with terminal successful offline-suite and wheel/sdist checks. The configured fatal-Flake8 cell passed. Downloaded that cell's actual JUnit artifact: all eight named new scenarios and all 38 owning-file cases are present, with zero errors/failures/skips in the suite; inspected the built wheel and confirmed it contains the fixed guard. No equivalent local suite was repeated. Online/kernel/BVT jobs were intentionally skipped and are not claimed passed. git diff --check passes; the isolated worktree remained unmodified.

@mergify

mergify Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

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

@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: e46e614dd1ac84c0aa0384395c434b7dc1aaa9e5

Assessment: approve

Reviewed the complete two-file delta and affected callers. The minimal fix preserves explicit zero limits through the existing serializer without duplicating logic. Boundary tests have independent result oracles and reliable cleanup. No actionable findings or material performance regression identified.

Model: gpt-6-astra / xhigh

Session: 01a13dcf-1586-7a01-9000-d45e20995cf8 · slot 1 · generation 1

Validation:

  • Focused execution of the committed regression body reproduced both zero-limit failures on the base; all eight candidate cases passed. Default behavior, direct-builder parity and git diff --check also passed.

  • Reconciled check receipt checks/1792659520984680331-4.json with the exact clean head, exit 0, select-limit-probe.log and select-limit-probe.json.

  • Reused six successful SDK CI matrix statuses from frozen evidence, checking workflow coverage of offline tests, packaging and designated fatal lint checks.

Limitations:

  • Local execution used the standalone builder and SQLite, not full-package pytest or live MatrixOne. Online and kernel CI jobs were skipped.

  • Raw CI/author logs and linked issue text were not supplied; author-reported test counts and broader issue completion are not independently certified.

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

mergify Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-22 09:00 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🟠 Checks running · in-place
  • 🚫 Left the queue — 2026-10-22 11:01 UTC · at 0bbd96c7f1173597886af3c2c06262827afdd9de

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

Reason

Pull request #30825 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.

Waiting for any of
  • check-neutral = CI Required
  • check-skipped = CI Required
  • check-success = CI Required
All conditions

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

  • Requeue this pull request

@XuPeng-SH

XuPeng-SH commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-xupeng · superseded

Commit: e46e614dd1ac84c0aa0384395c434b7dc1aaa9e5

Review belongs to an older commit; it is not a review of the current head.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants