Skip to content

fix(sql): preserve BIT binary bytes and unsigned window results - #32195

Merged
XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
aptend:fix/astra-meow-32122-32125
Nov 5, 2026
Merged

XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
aptend:fix/astra-meow-32122-32125

Conversation

@aptend

@aptend aptend commented Nov 4, 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:

Fixes #32122
Fixes #32125

What this PR does / why we need it:

Encode native BIT values as big-endian bytes of their declared width for explicit BINARY casts, before applying the existing destination truncation or right padding. This preserves leading zero bytes and non-symmetric values such as BIT(64) 258 -> 0000000000000102. Assignment and VARBINARY conversion behavior is unchanged.

Coerce native BIT arguments to BIGINT UNSIGNED for FIRST_VALUE, LAST_VALUE, LAG, LEAD and NTH_VALUE so their derived values, LENGTH results, VIEW projections and CTAS column types use the unsigned numeric domain. Coerce a BIT default argument consistently while retaining existing offset, frame and NULL behavior.

Validation:

  • Focused BIT conversion and value-window regression roots and the owning function package passed on the unchanged seven-file product content; the owning package normal run completed in 21.278s. These earlier tests retain their original base identities.
  • Both new canonical SQL cases passed normal mo-tester comparison on the source-matching CGO build based on 83907d1: 18 + 18 = 36/36 statements, 0 failed, 0 ignored and 0 abnormal. The actual service binary SHA-256 was e1ac27a57ceb8c2c388b78a56f3c1a858d20d54855c56bcf23db7e4fe9f91bc7. SQL readiness and the real ISCP task start preceded execution; the private TCP/UDP endpoints were checked before SQL. Fresh bounded teardown, catalog absence checks, the original parent wait and final listener/process cleanup all completed with numeric rc 0.
  • Rebased linearly onto latest upstream main 9e67b07. Its merge-receiver initialization optimization does not change the tested product paths; the seven product files and native/policy inputs were independently checked, so the prior functional execution was reused rather than claimed as a new-base test run.
  • Repository-pinned local SCA on that latest base passed with explicit full-fallback scope ./... selected by the repository workflow: node .github/ci/static-analysis.cjs; make STATIC_CHECK_PACKAGES=./... config; make STATIC_CHECK_PACKAGES=./... err-check; molint check -mod=readonly ./...; license-eye -c .licenserc.yml header check and dep check; golangci-lint run -v -c .golangci.yml ./.... All seven original return codes were 0; golangci-lint 2.14.0 reported 0 issues and the license header check reported 0 invalid files. Existing repository configuration was retained.

CI and reviewer decisions remain pending on the published HEAD. No multi-CN or deployment validation is claimed.

@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 Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: 2aebd67cb3cba52515cfa8e8d1cea05026a5c004

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: 2aebd67cb3cba52515cfa8e8d1cea05026a5c004

Assessment: approve

Both fixes reuse existing cast and window-domain handling. BIT encoding and unsigned window results satisfy the scoped contracts while preserving assignment, VARBINARY and non-BIT behavior. No actionable findings remain.

Model: gpt-6.1-sol / max

Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0

Validation:

  • Reviewed all seven changed paths, both discussion entries and linked issues #32122/#32125; traced cast, binder, window, rank, VIEW and CTAS consumers.

  • Preflight passed: checks/1793829850280122484-2.json; preflight.log.

  • Encoding probe passed 12,096 width/padding/truncation/NULL checks and reproduced the baseline defect: checks/1793829861763166776-2.json; bit-binary-probe.jsonl.

  • Independent source/fixture audit passed for all 36 SQL statements and byte/value/type oracles: checks/1793830073581225205-2.json; source-fixture-audit.log. Reconciliation: validation-evidence.json.

  • Frozen-head CI reports successful build, unit tests, SCA and proxy/pessimistic multi-CN BVT.

Limitations:

  • The local Go probe uses extracted production branches with a documented in-memory harness; full native packages and public SQL suites were not rerun locally.

  • Author-reported package and BVT runs retain older-base labels; detailed raw logs were not supplied.

@mergify mergify Bot added the queued label Nov 4, 2026
@mergify

mergify Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

🚫 Left the queue · pull request dequeued

3 h 22 min in the queue, with no time running CI.

So far

  • ✅ Entered the queue Wed 4 Nov, 22:13 · rule main · triggered by rule Automatic queue on approval for main
  • ⏹️ Testing stopped · in place
  • 🚫 Left the queue Thu 5 Nov, 01:35 · 3cd1f9b

Reason

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

To get back in the queue

  • Push a change if one is needed: the pull request is queued again once its queue conditions match.
  • If no change is needed, tick the box below to queue it again as it is.

Merge conditions not met when it left the queue

  • any of · required by GitHub branch protection:
    • check-neutral = CI Required
    • check-skipped = CI Required
    • check-success = CI Required

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

  • Requeue this pull request
2 merge conditions met
  • #review-threads-unresolved = 0 · required by GitHub branch protection
  • github-review-approved · required by GitHub branch protection

Times in UTC · dashboard · how the merge queue works

This branch was successfully deployed

No deployments
ci — 3cd1f9b6 Deployed Nov 5, 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 kind/test-ci size/M Denotes a PR that changes [100,499] lines

Projects

None yet

3 participants