Skip to content

docs/test: cover temporal compatibility exceptions - #29683

Merged
XuPeng-SH merged 6 commits into
matrixorigin:mainfrom
jiangxinmeng1:codex/issue-29207-zero-datetime-docs
Oct 8, 2026
Merged

XuPeng-SH merged 6 commits into
matrixorigin:mainfrom
jiangxinmeng1:codex/issue-29207-zero-datetime-docs

Conversation

@jiangxinmeng1

@jiangxinmeng1 jiangxinmeng1 commented Oct 8, 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 #28890

Related to #29207: this PR documents the mode/configuration contract, but does not claim that original YShop SQL runs unchanged without a permissive session or deployment sql_mode.

What this PR does / why we need it:

  • Documents that the default STRICT_TRANS_TABLES,NO_ZERO_DATE session mode rejects direct zero DATE/DATETIME/TIMESTAMP writes, including to nullable columns.
  • Documents the explicit per-connection SET SESSION sql_mode = 'NO_ENGINE_SUBSTITUTION' opt-in for applications that intentionally load legacy zero dates.
  • States explicitly that this is not transparent compatibility for an application that omits the session setting: changing 0000-00-00 00:00:00 to 1970-01-01 can change application semantics, and a server-level accept-and-retain switch is not introduced by this PR.
  • Clarifies INSERT IGNORE, prepared DML mode refresh, and NULL as the portable unknown-datetime representation.
  • Adds a focused [Bug]: JSON aggregates serialize TIMESTAMP in UTC instead of the session time zone #28890 BVT covering TIMESTAMP JSON_ARRAYAGG/JSON_OBJECTAGG output at UTC and UTC+8, prepared execution after a session timezone change, and the window aggregate path.
  • The production JSON temporal conversion is already present in the merged main ancestor (0c3f7e035d9); this PR adds the public regression contract without duplicating that implementation.

Validation

  • git diff --check — passed.
  • Existing aggexec unit coverage in pkg/sql/colexec/aggexec/jsonagg_test.go covers normal, accounted/preflight, spill/reload, and session-timezone TIMESTAMP conversion for both JSON aggregates.
  • Added test/distributed/cases/function/issue_28890_json_timestamp_agg.test / .result and extended test/distributed/cases/window/mysql_compat_window_json_arrayagg.sql / .result.
  • Remote validation used the available MatrixOne/mo-tester environment at 10.222.1.51. Its old 4.2-dev binary reproduced the pre-fix ... UTC aggregate output, confirming the issue; it predates the ancestor fix and does not support the current window JSON syntax, so it is not claimed as post-fix CI evidence.
  • Focused Go tests could not start locally because the environment lacks C headers usearch.h, roaring.h, xxhash.h, and jemalloc.h.
  • Post-push CI is not claimed passed here.

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

@matrix-meow matrix-meow added the size/XS Denotes a PR that changes [1, 9] lines label Oct 8, 2026
@mergify mergify Bot added the kind/documentation Improvements or additions to documentation label Oct 8, 2026
@jiangxinmeng1 jiangxinmeng1 changed the title docs: clarify zero temporal sql mode compatibility docs/test: cover temporal compatibility exceptions Oct 8, 2026
@mergify mergify Bot added kind/bug Something isn't working kind/enhancement kind/test-ci labels Oct 8, 2026
@matrix-meow matrix-meow added size/M Denotes a PR that changes [100,499] lines and removed size/XS Denotes a PR that changes [1, 9] lines labels Oct 8, 2026

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

Deep review of 016ba09 against merge-base 8929ab4. All five files/hunks reviewed personally; no subagents.

Request changes: one reproducible BVT oracle failure (inline). No additional production correctness or design blocker found in this docs/test-only delta.

Design, scope, and history

  • Production delta: zero. Documentation: +43 lines. SQL cases: +55 lines; expected results: +58 lines. No new state machine, validation owner, storage format, execution path, or production runtime cost. This ordinary docs/regression follow-up does not need another feature design document.
  • #29207's documented default, nullable-column distinction, permissive opt-in, direct INSERT IGNORE and prepared execution-time mode refresh agree with the existing assignment/session owners and the executed zero-temporal matrix. The latest documentation explicitly disclaims transparent YShop compatibility, and the PR now says “Related to #29207” rather than auto-closing it. This scope clarification is appropriate.
  • #28890's production conversion is already in ancestor 0c3f7e0. Normal/accounted aggregation reuse scalar temporal conversion; Group/Window supply the session timezone; merge/spill retain converted values. Public-path regression coverage is appropriate without duplicating that implementation.
  • Small one/two-row fixtures, explicit timezone save/restore, stable ordering, deallocated statements and database teardown are proportional. Ordinary and window cases exercise distinct owners. Existing tests cover other value types and errors; a broad duplicate test matrix is unnecessary. There are no prior human review threads to resolve.

Verification and evidence freshness

A clean binary was built at 09980fb (vcs.modified=false), Go 1.27.0, darwin/arm64. A fresh test-owned standalone CN/TN/logservice passed SQL and ISCP readiness. Runner: current mo-tester main 309a0ca650e0c55e90292767fd61e4976818d66d, bundled Connector/J 8.0.15, local Java 16, normal comparison flags -n -g -o -p.

Before submission, the new head 016ba09 was fetched and its entire incremental diff reviewed: it changes only the compatibility document (+10/-1). Production, cases/results, build configuration and dependencies are identical, so the following evidence remains valid without repeating the build/tests:

Validation Terminal result
New function case 18/19 twice, exit 1, identical first-column mismatch; 0.125s / 0.131s
Changed window case 25/25 twice, exit 0; 0.163s / 0.205s
Existing mysql_compat_temporal_zero.test 136/136, exit 0; 0.560s
Independent review-only SQL challenges 28/28 twice, exit 0; 0.175s / 0.156s
Focused aggregate UT 3 top-level tests PASS, -count=1, 3.465s
Nearest control: only first projection changed to CAST(ts AS CHAR) ts in a review copy 19/19, exit 0; all JSON assertions retained

The independent SQL challenges cover UTC -> +05:30 -> UTC prepared reuse with leap-day rollover, CTAS frozen JSON versus live-view reevaluation, NULL/empty input, current-row windows across non-null/NULL/non-null, NULL-key rejection and a successful next query. UT selection: TestAccountedJSONAggregatesLifecycleAndSpill, TestAccountedJSONPreflightOneByteShortDoesNotPublish, TestJSONArrayAggregateSharedTemporalAndYearConversion.

Catalog checks confirmed zero residual test databases/tables before repeat runs. Diff whitespace check passes. Submitted files were not edited; the review worktree is clean and the test-owned service was stopped. No concurrency/native/persistence code changed, so additional race/upgrade/performance suites would not add relevant proof. These script timings are not a production benchmark.

No completed CI result is claimed for the new head; this review does not wait for CI. Logs and review-only witnesses are retained at /tmp/mo-review-29683.UgkdKb/.

@jiangxinmeng1

Copy link
Copy Markdown
Contributor Author

Fixed in 529281a. The control projection in issue_28890_json_timestamp_agg.test/.result now uses CAST(ts AS CHAR) AS ts, matching the current mo-tester Connector/J representation. The JSON_ARRAYAGG/JSON_OBJECTAGG timezone and prepared-execution assertions are unchanged.

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

Re-review of 529281ab7a61b688a2fa8375ea8b27570c3486ab against merge-base 8929ab4946fbc7d44b6757fe5b12de6c74118c21, with freshly fetched main bab4b3286a0dd5683a9b291763817722233e586c. Personally reviewed; no subagents.

Approve. The blocking BVT oracle issue from my previous review is fixed; no remaining blocking design, correctness or test-quality finding in this docs/test-only scope.

Prior comments and fix verification

The entire delta since my previous reviewed head 016ba09528 is two matching one-line changes: select ts, -> select cast(ts as char) ts, in the function case and its expected result. Both committed files are byte-for-byte identical to the review-only control that already passed normal mo-tester comparison (19/19, 0.097s). I verified both with diff -u; neither produced a difference.

This normalizes only the JDBC-sensitive TIMESTAMP control representation. The exact scalar/array/object JSON values, microseconds, timezone switching, and prepared execution-time timezone assertions remain intact. There is no global comparison relaxation, ignored result column, or production workaround. The original review thread is resolved, and the author's follow-up identifies this exact fix. No other human review concern remains outstanding.

Design, scope and quality

The complete five-file delta remains: production implementation +0, documentation +43, SQL cases +55, expected results +58. Existing temporal assignment/session ownership and scalar-to-aggregate conversion remain the sole implementation paths; no duplicate validator, state machine, storage or execution branch is introduced.

The documentation describes MatrixOne's actual supported temporal policy rather than claiming transparent MySQL/YShop parity. Keeping #29207 related, rather than claiming the entire application-compatibility issue fixed, is correct. Ordinary aggregation, prepared reuse and window aggregation cover distinct consumers with one/two-row fixtures. Explicit timezone restoration, statement deallocation, database teardown and stable result ordering are retained. Extra broad duplicate matrices or a new design framework would not improve this patch.

Evidence reused after semantic freshness check

Production, build inputs, dependencies and all other test oracles are unchanged since the previous full review, so its qualifying evidence remains valid:

  • Function case: 19/19 normal comparison, using the now byte-identical committed case/result.
  • Changed window case: 25/25 on two same-instance runs.
  • Existing zero-temporal compatibility matrix: 136/136.
  • Independent SQL challenges: 28/28 twice, including +05:30 leap-day rollover, prepared timezone reuse, CTAS versus view materialization, NULL/empty input, current-row windows and NULL-key rejection followed by successful reuse.
  • Three focused aggregate lifecycle/spill/allocation-failure/temporal-conversion UTs: PASS.

These are deliberately reused results, not claims of a newly rebuilt binary or rerun suite. Environment and exact test names are recorded in the previous full review. No service was restarted just to repeat identical semantic evidence.

Current exact-head CI reports both proxy and pessimistic multi-CN BVT and CI Required successful (run 37719573108); the pessimistic job checks out this exact SHA and lists the new function case. UT/coverage/upgrade checks are skipped for this scope, not counted as test passes. Diff whitespace checks also pass.

No production hot path, concurrency, persisted format or upgrade behavior changes, so additional race/upgrade/throughput suites are not required for this delta. The measured sub-second case times are fixture-cost evidence, not a database performance claim.

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

mergify Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-08 04:23 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🟠 Checks running · in-place
  • 🚫 Left the queue — 2026-10-08 04:49 UTC · at 2f0afba61c93a35dd5d8ecb989085725343f9719

This pull request spent 26 minutes 34 seconds in the queue, with no time running CI.

Reason

The pull request can't be updated

This pull request seems to come 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, or update the branch manually.

Hint

You should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

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

  • Requeue this pull request

This branch was previously deployed

1 inactive deployment
ci — 2f0afba6 Deployed Oct 8, 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/documentation Improvements or additions to documentation kind/enhancement 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.

[Bug]: JSON aggregates serialize TIMESTAMP in UTC instead of the session time zone

3 participants