Skip to content

fix(frontend): preserve raw BIT bytes in MODUMP query results - #30655

Merged
mergify[bot] merged 3 commits into
matrixorigin:mainfrom
MatrixAdventurer:fix/modump-bit-bytes-30653
Oct 20, 2026
Merged

mergify[bot] merged 3 commits into
matrixorigin:mainfrom
MatrixAdventurer:fix/modump-bit-bytes-30653

Conversation

@MatrixAdventurer

@MatrixAdventurer MatrixAdventurer commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

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

What type of PR is this?

  • BUG

Which issue(s) this PR fixes:

Related to #30653.

What this PR does / why we need it:

MODUMP QUERY_RESULT currently converts BIT values to decimal text, although LOAD DATA consumes raw big-endian bytes. For example, BIT(8) value 1 is exported as ASCII "1" and restores as 49. Match the existing vector OUTFILE encoding and preserve BIT width metadata when reconstructing saved-result columns.

Add independent byte-oracle regressions for 10 widths (1–64), zero/one/max/NULL, and a real saveBatch/saveMeta/doDumpQueryResult file-service test. Both final regressions fail against unchanged production source 743e749 and pass with this patch.

Final scope: 3 files, +171/-2 (173 changed lines), including tests. No generated changes required. This restores MODUMP parity with ordinary OUTFILE; general CSV delimiter/enclosure handling of arbitrary binary values is outside this change.

Validation and independent review

Original fix head: 8b23b474564c7b2d700e2fca46160ee5fcd69e31.
Base: 743e749a1e33d6c845bb73999e8c82d297a2b657 (latest main rechecked before opening). No dev branch exists, so main is used under explicit user authorization.

Isolated fork verification run 39389359284, job 118516862335: success, Ubuntu 24.04 / Go 1.27.1:

  • make cgo -j4: unchanged native dependencies built.
  • GOWORK=off go build -mod=readonly ./pkg/frontend: pass.
  • GOWORK=off go vet -mod=readonly ./pkg/frontend: pass.
  • .agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=120s -run '^Test(ResultSetCSVBitEncoding|SavedQueryResultBitExport)$' -v ./pkg/frontend: pass.
  • .agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=120s ./pkg/frontend: pass (9.873s test execution).
  • gofmt -l for all three files and git diff --check: clean.

The validation ref efa94e1 adds only the independently reviewed, read-only fork workflow on top of the exact fix head. That workflow is excluded from this PR. Build/vet use the repository CGo include/library paths; tests use the unchanged controlled CGo wrapper.

Local focused tests also passed. Local complete frontend tests failed in the same 12 existing view-schema groups on both unchanged baseline and candidate because the sandbox lacks /proc memory-capacity information. The Ubuntu full-package run above resolved that environment blocker without skipping tests or changing production code.

Independent review agent: Approve, no material findings, on the complete three-file diff; Q1/Q2/Q3 lifecycle, wait and bounded-memory checks passed. No production concurrency change, so the ordinary owning-package lane applies. This is frontend package validation, not a claim that the full upstream CI suite has passed.

Operation record

由 LW 授权的 ChatGPT Personal 智能体提交。
Read-only checks, candidate/validation commit creation and independent branches in the verified user-owned MatrixAdventurer/matrixone fork were performed by the above agent. The fork relationship and write permission were read back. This PR does not change permissions, protections or hooks and does not merge/deploy/close issues. Assignment and review request to the repository owner XuPeng-SH will be verified after creation.

Follow-up: SCA preallocation correction (2026-10-20)

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

Current head: 9ef5011f99af73c017362ff396d2a7c53de04b94; complete PR remains 3 files, +171/-2. SCA attempt-2 job 118635303190 reports one concrete golangci-lint finding: export_bit_test.go:117 prealloc. Preallocate the expected slice with capacity 50 and length zero; cases, byte oracle and assertions are unchanged. This identifies a source finding rather than relying on the earlier timeout hypothesis.

Independent review: Approve, no findings, for fix tree b2056d9b2e0e00936215e0471a0dfbd2ff9c804f and the isolated verification workflow.

Fresh fork verification 39439786239, job 118686288086, Ubuntu24.04/Go1.27.1: all steps successful. It tests this exact fix head plus a validation-only workflow commit 73feabb72c1ccb20d44c71d43a21711d20b026d6:

  • go run github.com/alexkohler/[email protected] -set_exit_status pkg/frontend/export_bit_test.go: pass.
  • make cgo -j4: pass; frontend go build -mod=readonly and go vet -mod=readonly with repository CGo flags: pass.
  • Both BIT regressions via unchanged mo-cgo-test wrapper: pass (0.063s).
  • Complete frontend package via mo-cgo-test -count=1 -timeout=120s ./pkg/frontend: pass (8.717s).
  • Diff check: clean. No tests skipped or assertions weakened; no workflow enters the PR.

The upstream full SCA/CI for this new head still needs to run; the focused prealloc result is not a claim of full upstream SCA success. Current main was rechecked at ef07d45; none of its nine intervening commits modifies this PR's three files. The original base is retained; no unrelated changes were included. No merge, deployment or issue closure performed.

Preserve BIT width metadata when reconstructing saved query result columns and match ordinary OUTFILE raw-byte encoding. Add width, boundary, NULL and saved-result file regressions.

由 LW 授权的 ChatGPT Personal 智能体提交。
@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 智能体提交。

操作结果读回确认:本PR与Issue #30653均已指派给GitHub实际用户名 XuPeng-SH;本PR的 requested_reviewers 包含 XuPeng-SH。PR固定head 8b23b474564c7b2d700e2fca46160ee5fcd69e31,3文件+171/-2,无合并冲突。fork验证run39389359284全部成功,独立审查Approve;上游完整CI当前仍在运行/排队,尚未声称通过。未执行合并或关闭操作。

@MatrixAdventurer

Copy link
Copy Markdown
Contributor Author

CI follow-up on run attempt 1 (head 8b23b47, workflow run 39390456353) — 由 LW 授权的 MOI 智能体提交

Observed failure:

  • Only Matrixone CI execution / SCA Test on Linux/arm64 (job 118520522015) failed, at the Static Code Analysis step; the aggregate CI Required then reported failure. No other check job on this PR reported failure.
  • The SCA job ran 08:02:05Z → 08:47:11Z (~45m06s), right at the usual wall-clock budget of the arm64 SCA job, and the log head shows a clean runner setup plus a successful Restore golangci-lint analysis cache step.

What I could and could not verify:

  • The failing step's error tail is not retrievable through my tooling, so from the log alone I cannot distinguish a lint finding from a runner-side timeout/OOM.
  • Cross-evidence on the same head before opening: full pkg/frontend UT suite green, go vet ./... clean, build OK (fork validation gate), plus a red/green regression test for the BIT export path; I also re-checked the diff against the repo's .golangci.yml enabled-linter set and found no obvious match. The 45m06s duration is consistent with a timeout rather than a fast lint exit — hypothesis, not confirmed.

Action taken: re-ran the failed jobs (attempt 2, queued at 2026-10-20T12:47:31Z). I will re-check the attempt-2 result on my next scheduled pass and report back here. If the rerun fails again with a similar ~45 m duration, the evidence would point to the SCA time budget/runner load rather than this diff, and I'd ask a maintainer to confirm from the job internals or requeue on a warmer runner.

— MOI agent (authorized by LW), operated unattended; no code change is included in this update.

Address the prealloc finding from SCA job 118635303190 without changing test cases, expected bytes or assertions.

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

Copy link
Copy Markdown
Contributor Author

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

已处理真实SCA失败并更新本PR至 9ef5011f99af73c017362ff396d2a7c53de04b94(正常fast-forward,未强推)。attempt2 job118635303190日志明确只有 export_bit_test.go:117 prealloc;现将expected切片预分配为0长度、50容量,所有场景、oracle和断言不变。这纠正了此前仅凭运行时长推测timeout的判断;本轮没有对同样源码再次盲目重试。

独立review明确Approve。精确候选在fork run39439786239 全部通过:固定版本prealloc、make cgo、frontend build/vet、两组回归、完整frontend包测试(8.717s)。验证workflow独立审查Approve且不进入PR;完整PR仍3文件+171/-2。新head的完整上游SCA/CI仍待跑,不将聚焦linter视为全仓SCA通过。

操作记录:以上智能体重新核实本人fork及push权限;创建候选与独立验证提交,正常推进verify/modump-bit-30653和本PR分支;PR body已保留原始证据并补充本轮固定提交、命令与结果。原Issue/PR的XuPeng-SH指派和审阅请求保留,随后读回核对。未合并、部署、关闭Issue或修改门禁。

@MatrixAdventurer

Copy link
Copy Markdown
Contributor Author

CI follow-up on head 9ef5011, run 39440609231 attempt 1 — 由 LW 授权的 MOI 智能体提交

Observed failures(25 个 job 中 3 个失败,均为基础设施/级联失败,无任何测试执行到失败):

  1. Matrixone UT Coverage execution / UT Coverage on Ubuntu/x86(job 118689510494):失败点是 「Set up Go」步骤;Run coverage unit tests 及其后全部测试步骤均 skipped。没有任何单测被执行,失败发生在环境准备阶段。
  2. Matrixone Coverage execution / Coverage(job 118723780401):失败点是 「Verify coverage prerequisites」(15:40:03 → 15:40:08,仅 5 秒),Download test coverage artifacts、Merge profiles and check coverage rate 均 skipped——前置校验失败源于上面的 UT Coverage 供给者在装环境时即失败。
  3. CI Required(job 118729771499):在汇总校验步骤 Run actions/github-script@v7 失败(15:51:23 → 15:51:28,5 秒),是前两者失败后的级联聚合结论。

同一 head 上真正执行了的代码相关门禁全部通过: SCA Test on Linux/arm64 ✓(attempt 1 的 export_bit_test.go:117 prealloc 已在 9ef5011 修复后通过)、multi CN e2e BVT (COMPOSE, PESSIMISTIC) ✓、multi cn e2e bvt test docker compose(PROXY) ✓、CI preflight ✓、pr-size-label ✓。

判断依据: 三个失败 job 的最早失败点分别是环境安装步骤、5 秒内失败的前置校验、5 秒内失败的聚合校验,均不触及测试/静态分析/验收逻辑;本 diff(3 文件,+171/-2,frontend MODUMP BIT 导出及其回归测试)未改 go.mod/CI 配置,与「Set up Go」无关联路径。

Action taken: 已对 run 39440609231 发起重跑,读回确认 run_attempt=2、status=queued(updated_at 2026-10-20T16:08:32Z)。本轮无代码改动;我将在下一次定期回访时核对 attempt 2 结果并在此回报。若 attempt 2 仍在「Set up Go」同一步失败,将收集该步骤日志细节并请 maintainer 检查 runner。

— MOI agent (authorized by LW), operated unattended; 本轮无代码改动,未执行合并/关闭 Issue 或修改门禁。

@XuPeng-SH

XuPeng-SH commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: 9ef5011f99af73c017362ff396d2a7c53de04b94

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: 9ef5011f99af73c017362ff396d2a7c53de04b94

Assessment: approve

Reviewed the complete three-file delta and supplied discussions. The fix restores MODUMP parity with existing BIT encoding and reuses the authoritative column-metadata helper. Encoding work is bounded to eight bytes per value, with no new production state or I/O. No actionable findings remain.

Model: gpt-6-astra / xhigh

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

Validation:

  • The frontend package passed with 2,485 top-level tests, including both new BIT regressions. Independent byte oracles cover ten widths, zero, one, maximum values and NULL; the saved-result test exercises metadata persistence and actual file-service output.

  • Isolation preflight, repository-owned native build, native provenance verification, formatting and source audit passed. All 190 native inputs matched; source remained unchanged.

  • Reconciled commands, source fingerprints, terminal receipts and logs in /home/xupeng/.local/state/mo-bot/jobs/1e2554626df1e34ec7eb6087/attempt-1/validation-manifest.json. Frontend execution receipt: checks/1792517760498620456-3.json; final audit: checks/1792517772009990547-3.json.

  • Frozen exact-head CI reports successful UT, SCA and BVT checks. The reported preallocation concern is corrected in the current test.

Limitations:

  • Local validation used Linux/amd64 and Go 1.27.1. The unrelated TestRuleCacheDoubleCheckLocking contains an existing explicit skip.

  • No separate SQL-client MODUMP/LOAD DATA round trip was run. General CSV delimiter/enclosure handling of arbitrary binary bytes remains a documented pre-existing limitation.

  • The linked issue body and raw CI logs were unavailable; requirements were assessed from the frozen PR, discussions and source.

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

mergify Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-20 17:37 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ✅ Checks passed · in-place
  • ✅ Merged — 2026-10-20 18:55 UTC · at 774d0eda08c622e8717bed8caa8cd8c2ae3ffc2a · squash

This pull request spent 1 hour 18 minutes 22 seconds in the queue, including 1 hour 3 minutes 19 seconds running CI.

Required conditions to merge

@MatrixAdventurer

Copy link
Copy Markdown
Contributor Author

SCA/CI 最终回访确认 · 由 LW 授权的 MOI 智能体提交

按此前(12:49Z、13:53Z 流程)承诺,对 SCA 失败的复核及后续结果记录如下:

1. 原头 attempt-2(8b23b47)最终状态:cancelled,非失败。 Run 39390456353 复苏因推送修复固化头 9ef5011 而取消(updated 14:35:48Z),与已定位的单一 lint 定位(attempt2 job 日志 export_bit_test.go:117 prealloc)相辅相成,不再是 open 的 timeout 假设。

2. 上游完整 CI 在修复固化头 9ef5011 上全绿。

  • MatrixOne ALL CI run 39440609231 attempt 2:success(16:08:17Z→17:25:48Z)。此前 attempt-1 唯一失败的 SCA Test on Linux/arm64 属该套件,此轮通过,SCA 修复生效。
  • Iceberg Connector E2E(39440612153)、Connector/J Pool Reset E2E(39440612349):success。

3. 评审与排队状态(截至本时点)。

  • XuPeng-SH 于 17:36:51Z 就 'Commit: 9ef5011' 提交 APPROVE(review 5589098339,无遗留可操作发现),#review-threads-unresolved = 0 满足。
  • PR 由 Automatic queue on approval for main 于 17:37:30Z 进入合并队列(in-place 模式),Mergify 将最新 main(base 180608ea)合并到分支形成当前 head 00f0b211;queue 校验 run 39469692451(MatrixOne ALL CI)截至 18:01Z 进行中,ETA 18:53Z。本智能体不执行任何合并/关闭操作;若 queue 校验通过,将由仓库既有规则自动完成合并。

4. 交付边界复核。 修复范围始终为 3 文件 +171/-2(如初审标题及 PR 描述记录);PR 与 Issue #30653 均已指派 XuPeng-SH;独立评审在 fork 精确头上持续推进 approve;fork 验证 39439786239 全步成功;以上无跳过项。

(机器人无人值守操作,仅记录证据,未对分支做任何新的变更。)

@mergify
mergify Bot merged commit 774d0ed into matrixorigin:main Oct 20, 2026
@mergify mergify Bot removed the queued label Oct 20, 2026
mergify Bot pushed a commit that referenced this pull request Nov 15, 2026
## What type of PR is this?

- [ ] API-change
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [ ] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

Fixes #30653

## What this PR does / why we need it:

Loading numeric JSONLINE fields into BIT previously interpreted the decimal digits as raw bytes: 1 became 49, and narrow or large values could not reload correctly. This completes the JSONLINE half of #30653; the CSV half was fixed in #30655.

- Preserve JSON NUMBER provenance for object and array fields, then convert canonical nonnegative uint64 values before direct BIT construction and the staged varchar-to-BIT cast. Zero, narrow values, 2^53+1 and UINT64_MAX retain their exact values.
- Match NULLIF against the raw field before numeric conversion. Quoted strings, JSON null, CSV and Kafka retain their existing behavior; the OUTFILE exporter is unchanged.

Validation:

- Native regression tests reproduce 32 failing subtests on the original source (RED exit 1), then pass 8 top-level tests and 49 subtests. Full external/csvparser package tests and frontend CSV/saved-result plus plan NULLIF guards pass with the CGO/native test wrapper.
- `make static-check-selected STATIC_CHECK_PACKAGES="./pkg/sql/util/csvparser ./pkg/sql/colexec/external"` passed with 0 issues.
- One real native foreground run completed normal MoTester `method=run` with full metadata: 36/36 SQL statements passed, error.txt was empty, and the console contained no hidden SQLException. Independent byte/JSON-kind checks verified both BIT JSONLINE exports, including saved query results, followed by successful reloads.
- A typed PyMySQL LOAD of the out-of-width JSON numeric value 256 into BIT(8) retained error 20101/HY000. The same connection then completed SELECT 1 and a valid two-row LOAD; cursors, connections, owned databases, service/client processes and planned ports were cleaned.
- Public SQL coverage uses small serial and compressed inputs. Native unit tests exercise the actual staged varchar-to-BIT consumer.


Approved-by: XuPeng-SH <[email protected]>

This branch was previously deployed

1 inactive deployment
ci — 00f0b211 Deployed Oct 20, 2026 by mergify[bot]
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/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants