Skip to content

fix: support TIMESTAMP(date, time) - #27722

Merged
mergify[bot] merged 7 commits into
matrixorigin:mainfrom
VioletQwQ-0:codex/issue-27649-timestamp-pair
Aug 27, 2026
Merged

fix: support TIMESTAMP(date, time)#27722
mergify[bot] merged 7 commits into
matrixorigin:mainfrom
VioletQwQ-0:codex/issue-27649-timestamp-pair

Conversation

@VioletQwQ-0

@VioletQwQ-0 VioletQwQ-0 commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

issue #27649

What this PR does / why we need it:

  • adds the two-argument TIMESTAMP(date, time) overload without changing existing unary overload IDs or semantics
  • accepts typed DATE/DATETIME/TIMESTAMP/TIME and CHAR/VARCHAR/TEXT representations; binary string OIDs are rejected during binding
  • returns nullable DATETIME(fsp), deriving valid constant-string FSP from fractional digits while keeping columns and parameters conservative
  • extracts typed and datetime-shaped DATETIME clock time with a stable date subtraction, so results do not depend on whether the value date is today or tomorrow
  • supports signed D hh:mm:ss elapsed-time strings, applies session timezone to a TIMESTAMP first argument, and returns NULL for invalid or out-of-range rows
  • adds function, planner/CTAS, protocol metadata, prepared-statement, and distributed SQL regression coverage

QA required: yes. This changes user-visible SQL compatibility behavior.

Validation on exact head 4ae2d80f21397de3dc0d0d9cea2385e8df95cc33:

  • repository-CGo full tests for ./pkg/sql/plan/function: PASS
  • repository-CGo full tests for ./pkg/sql/plan: PASS
  • focused timestamp-pair execution and CTAS planner tests: PASS
  • semantic preflight: PASS semantic=PASS with clean-head diff hash 647418b5bc6f4dbe41f24e4201d4cbb862745dcaefd62f514636a3619a525d10
  • gofmt -d and git diff --check: PASS; worktree is clean and local HEAD equals the remote PR head
  • plain GOWORK=off go build and go vet for ./pkg/sql/plan/...: BLOCKED by the existing pkg/common/docfilter CGo symbol-resolution environment; no build/vet pass is claimed
  • current-head BVT run 33100156204 isolated two stale expected metadata/value rows in func_timestamp.test; the result oracle now records DATETIME(0) for the no-fraction literals and preserves DATETIME(6) for the fractional literal
  • fresh exact-head CI is running after the repair push

@matrix-meow matrix-meow added the size/L Denotes a PR that changes [500,999] lines label Aug 27, 2026
@mergify mergify Bot added the kind/bug Something isn't working label Aug 27, 2026
@VioletQwQ-0
VioletQwQ-0 marked this pull request as ready for review August 27, 2026 05:57
@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 →

@VioletQwQ-0

Copy link
Copy Markdown
Collaborator Author

Addressed the current-head P1 on d0bebfdcba5f02921171a5af334f518e1cd4f5ac.

  • Added stable DATETIME clock extraction using value - value.ToDate().ToDatetime(), with ZeroDatetime treated as invalid.
  • Typed DATETIME, ISO-T datetime text, and space-separated datetime text now use the stable time-of-day path, so results no longer depend on whether the value date is today or tomorrow.
  • Added a today/tomorrow regression covering typed, space-text, and ISO-T inputs, plus a production BVT assertion covering textual and typed DATETIME inputs.

Validation on the pushed head before publication: function-package CGo tests PASS, timestamp-pair race tests PASS, CTAS planner test PASS, and semantic preflight PASS. Local go build/go vet for pkg/sql/plan/... remain blocked by the existing docfilter CGo symbol-resolution environment. The previous current-head Compose BVT failure was the datetime-shaped timestamp-pair case; the Coverage failure was a prerequisite consequence. Fresh CI is now running for this head.

Please re-review the timestamp-pair change.

Comment thread pkg/sql/plan/function/func_timestamp_pair.go
aptend
aptend previously requested changes Aug 27, 2026

@aptend aptend 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 exact head d0bebfd against base 662c1bd and prior reviewed head 63fde56. I read the complete review/comment/reply history, including the resolved thread, checked the repair increment, and re-audited the full PR diff and issue #27649.

The previous blocker is closed: typed and datetime-shaped values now extract a stable clock component with date subtraction, so today/tomorrow no longer changes the result. The full-diff audit found one remaining blocking character-input format gap; see the inline P1. A separator-free DATETIME accepted by MatrixOne and MySQL is still misread as an enormous elapsed TIME and becomes NULL.

Validation on the exact head:

  • full ./pkg/sql/plan/function tests passed
  • focused timestamp-pair and CTAS planner race tests passed
  • a temporary focused compact-DATETIME counterexample reproduced the NULL result and was removed
  • a local MySQL 9.6 control returned 2024-01-01 12:00:00.123456 for the identical query
  • git diff --check passed and the worktree was clean

Fresh exact-head CI was still in progress when this review was submitted; no CI completion is claimed.

@VioletQwQ-0

Copy link
Copy Markdown
Collaborator Author

Addressed the current-head BVT failure from run 33100156204 on 6066cc51d82e0b286b1f151ec36398070c796e98.

  • func_timestamp.test rows 31-32 returned the correct timestamp values, but the expected metadata/text still treated the no-fraction datetime-shaped and short numeric literals as DATETIME(6).
  • Updated only test/distributed/cases/function/func_timestamp.result so those literals expect DATETIME(0) while the fractional compact literal remains DATETIME(6).
  • The Coverage failure was at prerequisite verification and is a downstream consequence of the BVT failure; no separate code issue was found.

Validation on pushed head 4ae2d80f21397de3dc0d0d9cea2385e8df95cc33:

  • repository-CGo full tests for ./pkg/sql/plan/function: PASS
  • repository-CGo full tests for ./pkg/sql/plan: PASS
  • focused timestamp-pair and CTAS planner tests: PASS
  • semantic preflight and git diff --check: PASS
  • worktree is clean and the remote PR head matches the pushed commit

Fresh checks are pending on the repaired head. The existing review threads remain resolved; LeftHandCold is still the active review request.

@mergify

mergify Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • Entered queue2026-08-27 21:08 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • Checks passed · in-place
  • Merged2026-08-27 23:09 UTC · at 900f28c66a5de7efebce91c6217766d07b69b73b · squash

This pull request spent 2 hours 1 minute 15 seconds in the queue, including 45 minutes 29 seconds running CI.

Required conditions to merge
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • github-review-approved [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / SCA Test on Linux/arm64
    • check-neutral = Matrixone CI / SCA Test on Linux/arm64
    • check-skipped = Matrixone CI / SCA Test on Linux/arm64
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Utils CI / Coverage
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-neutral = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-skipped = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-neutral = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)

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.

5 participants