Skip to content

[4.2] fix: preserve empty saved results and result_scan projections - #32803

Merged
XuPeng-SH merged 3 commits into
matrixorigin:4.2-devfrom
XuPeng-SH:backport/30641-result-scan-4.2-dev
Nov 16, 2026
Merged

XuPeng-SH merged 3 commits into
matrixorigin:4.2-devfrom
XuPeng-SH:backport/30641-result-scan-4.2-dev

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Nov 16, 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:

Related to #30553 and #30571.

Related to matrixorigin/matrixflow#18267.

What this PR does / why we need it:

Backport the saved-result fixes from #30641 to 4.2-dev:

  • Persist a typed empty block before the metadata for a successful zero-row query, so a newly saved empty result can be read by result_scan and exported.
  • Preserve the mapping from projected result columns and filter columns to their physical positions in the saved result file.
  • Retain the upstream result-scan regression cases and adapt their types and fixtures to the 4.2 branch.
  • Update the existing direct-reader test fixture with physical column indexes, and preserve ENUM metadata when creating an empty result block.

The MODUMP rotation context addressed by #30641 is already handled by the 4.2 export lifecycle in #30742, so this backport retains that existing implementation.

Validation

  • Go 1.26.4, macOS arm64: gofmt, git diff --check, and go vet passed for the changed Go packages.
  • The pkg/frontend, pkg/sql/colexec/external, and pkg/sql/plan test binaries compiled with -race; they were not executed locally.
  • The backported UT and SQL regression cases and the full CI have not yet been executed on this revision.

Previously saved results without data blocks are not repaired by this change. End-to-end verification requires a newly executed query.

@XuPeng-SH
XuPeng-SH requested a review from aunjgr as a code owner November 16, 2026 07:51
@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 commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is merged.

Backport the empty-result persistence and result-scan projection fixes from matrixorigin#30641. The MODUMP context lifetime is already handled by matrixorigin#30742 on 4.2-dev.

(cherry picked from commit 9f7fe43)
@XuPeng-SH

XuPeng-SH commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: 9964cd8897c04e8f71ef5d02add106f8591e892e

Review completed. Read the assessment.

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

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

Commit: 9964cd8897c04e8f71ef5d02add106f8591e892e

Assessment: request_changes

The backport appropriately reuses the result writer and physical column mapping; source review found no confirmed implementation defect. Required execution evidence for the 4.2 saved-result/readback/export paths remains missing.

Model: gpt-6.1-sol / max

Session: 01a1e395-a6d9-7ad1-bf20-81f1c6210100 · slot 2 · generation 0

  • P2 test/distributed/cases/query_result/query_result.sql:221: Merge the 4.2 backport without executing the changed saved-result regression and its public export path.
    Impact: The zero-row persistence and pruned/filter-column mapping changes have no relevant completed execution on this branch. Run the changed query_result case in normal comparison mode, verify a newly saved empty result exports a header-only CSV, and supply successful focused/owning-package results (or matching completed CI).
    Evidence: The PR states its test binaries were only compiled and regression/CI execution had not completed. evidence.json.local_validation is empty; relevant frozen-head build/UT/SCA checks remain IN_PROGRESS. Linked issue successes cover older main builds, explicitly not 4.2. focused-zonemap.log stopped before tests because libmo.so is missing; that environment diagnostic is not a product failure.

Validation:

  • Complete seven-file source/consumer review and all three PR discussion entries; discussion-assessment.json covers 3/3 keys.

  • Shared private-/tmp and loopback preflight passed; preflight.log and its check receipt retained.

  • git diff --check passed for the frozen base/head; diff-check.log and its check receipt retained.

  • Attempted Test_translateZonemapFilterColumnMap with repository mo-cgo-test and assigned test-exec; stopped before compilation/execution due to missing cgo/libmo.so.

Limitations:

  • No Go test or public SQL/MODUMP execution completed locally; current-head relevant CI was pending in the supplied snapshot.

  • The related MOI production version, HTTP/UI behavior and previously saved blockless results are outside this backport's verified scope.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ XuPeng-SH
❌ Codex


Codex seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@XuPeng-SH

XuPeng-SH commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: 662adbbd89444e7b46cbb27a71b5d5a0dac0517b

Review completed. Read the assessment.

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

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

Commit: 662adbbd89444e7b46cbb27a71b5d5a0dac0517b

Assessment: approve

The focused backport reuses the existing result writer and physical-column mapping. Local execution closes the earlier validation gap; no actionable defects remain.

Model: gpt-6.1-sol / max

Session: 01a1e395-a6d9-7ad1-bf20-81f1c6210100 · slot 2 · generation 0

Validation:

  • Six focused regressions, all three owning packages, and go vet passed on Linux/amd64 with Go 1.26.6.

  • Public MySQL probes passed: 39 canonical SQL statements compared twice with teardown checks, empty tenant SHOW replay twice, and header-only CSV export.

  • Verified frozen source, complete seven-file delta, native input provenance, all six discussion keys, and receipt/log reconciliation; records are retained in check-ledger.json.

Limitations:

  • Frozen CI remains pending. The full external mo-tester suite and deployed MOI HTTP/UI paths were not run.

  • One unchanged rule-cache test was skipped. Initial dependency timeout and strict-string probe failure were recovered and retained separately.

This branch was successfully deployed

No deployments
ci — 134c6a56 Deployed Nov 16, 2026 by XuPeng-SH
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.

3 participants