Skip to content

fix: preserve prepared temporal result types and values - #30224

Merged
mergify[bot] merged 2 commits into
matrixorigin:mainfrom
iamlinjunhong:fix/prepared-temporal-results-30192-30197
Oct 19, 2026
Merged

mergify[bot] merged 2 commits into
matrixorigin:mainfrom
iamlinjunhong:fix/prepared-temporal-results-30192-30197

Conversation

@iamlinjunhong

@iamlinjunhong iamlinjunhong commented Oct 14, 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:

Please leave these issues open for reporter verification after merge.

What this PR does / why we need it:

Prepared temporal expressions could expose string result types, discard time-of-day before CTAS materialization, or select an executor with an incompatible TIME result vector. Unary TIMESTAMP also lost fractional precision and introduced timezone-dependent materialization.

Preserve direct parameter provenance and consume calendar operands before provisional casts truncate them. DATE_ADD/DATE_SUB use the original interval unit for DATE versus DATETIME(6); TIMESTAMPADD preserves full calendar inputs. Unary TIMESTAMP binds to appended DATETIME overloads 6–10, while released overloads 0–4 retain their original execution ABI and pair overload 5 stays unchanged. Dynamic ADDTIME/SUBTIME compute calendar arithmetic before extracting TIME(6), preserving genuine durations over 24 hours and explicit SQL casts. The FROM_UNIXTIME reproduction already passes on base; retain source-type and reuse regressions without an unnecessary kernel change.

MORPC 122 protects the changed result contracts after released main epochs 114–121. Reuse existing expression classification, worker placement, actual-destination validation, receiver/persisted gates and execution-stream handshake. Cached Compile/Run rejects capability rollback before effects. Borrowed CREATE plans are checked before name refresh and after rebuilding.

Ordinary CTAS releases its bound query, so retain an execution-only protocol scalar before folding/query release, including nested and stored-view binding scopes. Prepared CTAS retains its authoritative query and leaves the scalar zero. The scalar survives protobuf/clone operations and is cleared with population SQL/query from temporary schema-only plans. It is not a catalog storage floor. This adds bounded planning observation and an O(1) execution check, with no per-row work, new handshake, cache or parallel execution path.

Prior validation on head 70093d9 includes focused planner tests plus normal/race owning-package tests, incremental SCA across eight affected/consumer packages, repeated canonical protobuf generation, and the actual public prepared-temporal SQL suite with golden-result comparison (130 statements). Controls include precision, NULL/masks, invalid/overflow inputs, native TIME durations, explicit casts, folded/nested/prepared/temporary CTAS, stored views, wire/clone preservation, pre-catalog rejection and rollback before execution.

The design is documented in the versioned compatibility design, maintenance revision 5. Full CI, live mixed-binary rollout and TP throughput are not claimed. Epoch 120 retains official main's KILL authorization and proxy cleanup contract; epoch 121 retains the exact unsigned DECIMAL DIV contract; this temporal capability appends epoch 122. The allocation is checked against official main again before delivery.

Rebased onto official main 873282742714436bff407dfcdbbe879147162bd3. Current validation passed focused temporal/CTAS/lifecycle admission tests, six complete owning packages, vet and incremental lint. Compatibility controls reject predecessor 121, admit 122, reject 122-to-121 rollback before effects, and reject future CTAS requirement 123. Main's epoch-120 authorization and epoch-121 DECIMAL DIV consumers, and the existing plan wire schema, remain unchanged. Mixed-feature placement, sending, receiving and persisted requirements compose to 122; pure DECIMAL DIV remains available at 121. Mixed folded CTAS and stored-view expansion retain DATETIME(3) and unsigned INT schema contracts. On a default-SIMD standalone service, normal golden comparison passed the 130-statement prepared-temporal suite and the 29-statement upstream DECIMAL DIV domain suite twice each, with database teardown verified after every round. Additional public SQL checks passed mixed direct/folded CTAS and stored-view expansion: DATETIME(3), unsigned INT, exact values, and UTC/+08 behavior. The isolated service shut down cleanly and its temporary binary was removed.

@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 14, 2026
@matrix-meow matrix-meow added the size/XL Denotes a PR that changes [1000, 1999] lines label Oct 14, 2026
Preserve calendar precision and result ABI; retain CTAS execution requirements through folding, view expansion, serialization and rollback.
@XuPeng-SH

XuPeng-SH commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-xupeng · done

Commit: ef416ed211fcda8f0e8838f66fd7289da61bf8d8

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-xupeng · review

Commit: ef416ed211fcda8f0e8838f66fd7289da61bf8d8

Assessment: approve

Reviewed the complete 41-file delta, callers, ownership, compatibility, failure paths and test quality. The prior TIMESTAMP ABI concern is addressed by appended overloads and protocol-122 admission. No actionable findings remain.

Model: gpt-6-astra / xhigh

Session: 01a14d34-4e51-79a3-a62d-6c9c16279dc8 · slot 0 · generation 0

Validation:

  • 108 top-level tests passed: 57 protobuf-plan tests, 24 focused temporal/planner/compile tests, and 27 adjacent temporal and optimizer controls. All used the supplied isolated executor.

  • Test logs and exact-head exit-zero receipts are reconciled in /home/xupeng/.local/state/mo-bot/jobs/52bb0c0d3230c99a387d7a0d/attempt-1/validation-audit.json.

  • Recovered native prerequisites through repository make cgo using 192 matching inputs; retained input and artifact hashes. The initial prerequisite failure occurred before test compilation.

  • Descriptor audit confirmed only additive CreateTable field 19. Patch contents, whitespace checks and unchanged source status were verified.

  • Frozen exact-head CI metadata reports successful build, UT, SCA, coverage and BVT checks.

Limitations:

  • No local SQL BVT, live mixed-binary cluster or throughput benchmark was run.

  • CI statuses and author reports were distinguished from independently verified local execution; author raw logs were not supplied.

  • Linked issue bodies were not bundled; their stated contracts were assessed through the supplied PR text, comments and regression tests.

@mergify

mergify Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-19 10:30 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ✅ Checks passed · in-place
  • ✅ Merged — 2026-10-19 12:16 UTC · at d82e828b0a4df9ce635fe573c1e90c5cde978bf9 · squash

This pull request spent 1 hour 46 minutes 44 seconds in the queue, including 57 minutes 14 seconds running CI.

Required conditions to merge

This branch was previously deployed

1 inactive deployment
ci — 58523f27 Deployed Oct 19, 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 kind/enhancement size/XL Denotes a PR that changes [1000, 1999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants