Skip to content

fix(sql): align WEEK and DAYOFYEAR result type contracts with MySQL - #30101

Merged
mergify[bot] merged 3 commits into
matrixorigin:mainfrom
iamlinjunhong:fix/29999-calendar-result-types
Oct 13, 2026
Merged

mergify[bot] merged 3 commits into
matrixorigin:mainfrom
iamlinjunhong:fix/29999-calendar-result-types

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:

Leave the issue open for reporter verification after merge.

What this PR does / why we need it:

WEEK() and DAYOFYEAR() expose narrow unsigned types to JDBC and CTAS. CTAS consequently rejects inserts such as (256,65536) even though MySQL accepts them. Bind and execute these functions with signed INT results, so CTAS stores INT; reuse the existing frontend presentation mechanism to expose signed BIGINT for eligible direct queries and prepared statements, matching MySQL's type contract.

Preserve legacy serialized UINT8/UINT16 execution through the existing result-wrapper boundary, and require MORPC v112 for new signed result contracts at worker placement, destination validation, receiver validation and persisted-expression admission. Numerical results, NULL/zero handling, week modes and session defaults are covered by regression tests. Direct metadata coverage follows the existing projection guards for materialization and ordinal handling.

Validation on macOS arm64 with Go 1.27.1:

  • Focused regressions and complete owning packages: defines, function, frontend, protobuf plan, compile, planner and SQL integration.
  • Connector/J 8.4.0: ordinary queries and client/server prepared statements; metadata before binding and after execution, signed BIGINT/Long, and valid/NULL/valid reuse.
  • Updated CTAS BVT and three affected temporal/coercion cases: normal comparison twice per case; CTAS database teardown checked between runs.
  • Formatting, incremental go vet and repository-pinned golangci-lint v2.14.0.

WEEK result payloads grow from one to four bytes per row, DAYOFYEAR from two to four. The arithmetic loop and NULL bitmap remain unchanged; no intermediate widening vector or additional per-row pass is introduced. Mixed-version checks use the existing capability probes. CI results are pending.

@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 added the kind/bug Something isn't working label Oct 13, 2026
@matrix-meow matrix-meow added the size/L Denotes a PR that changes [500,999] lines label Oct 13, 2026
@iamlinjunhong
iamlinjunhong force-pushed the fix/29999-calendar-result-types branch from 92e375b to 2c65782 Compare October 13, 2026 09:04
@XuPeng-SH

XuPeng-SH commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: b3669cfa4afa9236290290dd863cf5a5eaf04a94

Assessment: approve

Reviewed the complete 25-file delta. Signed INT execution and CTAS storage, eligible direct BIGINT metadata, legacy serialized execution, and v112 compatibility gates satisfy the declared scope. No actionable findings remain.

Model: gpt-6-astra / xhigh

Session: 01a12d8f-7dea-77c2-a565-38d45b5564e4 · slot 0 · generation 0

Validation:

  • Verified frozen head, unchanged source, clean diff check, matching native-build inputs/artifacts, and successful isolation preflight.

  • 19 focused tests passed across six packages, covering result types, NULL/masked rows, session defaults, legacy/current serialized execution, protocol placement/send/receive, and persisted-expression admission.

  • Live SQL integration passed all four scenarios: column metadata, interpolated queries, server-prepared valid/NULL/valid reuse, and signed INT CTAS storage with wider inserts. Fixture shutdown completed.

  • Focused execution receipt checks/1791911127844719609-3.json and final audit receipt checks/1791911294729948390-4.json both record exit 0 at the assessed head.

  • Commands, hashes, receipts, logs, and review scope are retained in validation-summary.json and review-analysis.json under /home/xupeng/.local/state/mo-bot/jobs/a40e550939b0538832aeeb3b/attempt-1. Frozen CI records successful unit, build, static-analysis, and BVT checks.

Limitations:

  • Compatibility validation used serialized expressions and controlled endpoint capabilities, not a live mixed-version cluster.

  • Connector/J and mo-tester runs were author-reported; they were not repeated locally, and raw CI logs were not supplied.

  • BIGINT presentation retains existing projection guards. Result-buffer widening is intentional; no throughput benchmark was performed.

  • The linked issue body was absent; its required behavior was taken from the frozen PR description.

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

Assessment: approve

Reviewed the complete 25-file delta. Signed INT execution and CTAS storage, eligible direct BIGINT metadata, legacy serialized execution, and v112 compatibility gates satisfy the declared scope. No actionable findings remain.

Model: gpt-6-astra / xhigh

Session: 01a12d8f-7dea-77c2-a565-38d45b5564e4 · slot 0 · generation 0

Validation:

  • Verified frozen head, unchanged source, clean diff check, matching native-build inputs/artifacts, and successful isolation preflight.

  • 19 focused tests passed across six packages, covering result types, NULL/masked rows, session defaults, legacy/current serialized execution, protocol placement/send/receive, and persisted-expression admission.

  • Live SQL integration passed all four scenarios: column metadata, interpolated queries, server-prepared valid/NULL/valid reuse, and signed INT CTAS storage with wider inserts. Fixture shutdown completed.

  • Focused execution receipt checks/1791911127844719609-3.json and final audit receipt checks/1791911294729948390-4.json both record exit 0 at the assessed head.

  • Commands, hashes, receipts, logs, and review scope are retained in validation-summary.json and review-analysis.json under /home/xupeng/.local/state/mo-bot/jobs/a40e550939b0538832aeeb3b/attempt-1. Frozen CI records successful unit, build, static-analysis, and BVT checks.

Limitations:

  • Compatibility validation used serialized expressions and controlled endpoint capabilities, not a live mixed-version cluster.

  • Connector/J and mo-tester runs were author-reported; they were not repeated locally, and raw CI logs were not supplied.

  • BIGINT presentation retains existing projection guards. Result-buffer widening is intentional; no throughput benchmark was performed.

  • The linked issue body was absent; its required behavior was taken from the frozen PR description.

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

mergify Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-13 17:09 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ✅ Checks passed · in-place
  • ✅ Merged — 2026-10-13 18:34 UTC · at 1b66ff135c64ef1c642a297105bf599cd3173dee · squash

This pull request spent 1 hour 25 minutes 6 seconds in the queue, including 1 hour 24 minutes 26 seconds running CI.

Required conditions to merge

@mergify
mergify Bot merged commit 1b66ff1 into matrixorigin:main Oct 13, 2026
@mergify mergify Bot removed the queued label Oct 13, 2026
cpegeric added a commit to cpegeric/matrixone that referenced this pull request Oct 14, 2026
main took MORPCVersion112 for signed WEEK/DAYOFYEAR result vectors (matrixorigin#30101),
so low-precision float integer arguments move to MORPCVersion113: the
remote-expression gate, the expression-contract version, the persisted
expression floor and their tests (a v112 destination is now the rejected
case). mysql_sql.go is regenerated from the merged grammar.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

This branch was previously deployed

1 inactive deployment
ci — 1df77184 Deployed Oct 13, 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/L Denotes a PR that changes [500,999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants