Skip to content

test(function): cover fractional TIME arithmetic - #28957

Merged
XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/issue-28953-time-arithmetic-20260916
Sep 16, 2026
Merged

XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/issue-28953-time-arithmetic-20260916

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

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

Which issue(s) this PR fixes:

Refs #28953

What this PR does / why we need it:

This PR closes the regression-coverage gap for the fractional TIME(3) arithmetic reported by #28953.

The clean failing CI job was run from PR #28825 head 7df20be7d318, not from current main or this PR. That change normalized the plain decimal literal 0.001 to .001; the subsequent string-to-TIME cast loses the fraction. Current main does not contain that normalizer, so #28957 is a guard for that historical regression rather than a claim of a new TIME-kernel production fix.

Changes:

  • Add a planner binder regression test that preserves the exact numeric literal text when binding decimal literals to TIME(3), including 0.001, 34.5, and -0.001.
  • Mark the existing TIME(3) multiply/divide/modulo BVT statements for metadata comparison.
  • Assert client-visible DECIMAL metadata: [3,38,3], [3,38,9], and [3,18,3], alongside the fractional values.

Validation:

  • go test ./pkg/sql/plan -run TestBindTimeDecimalLiteralPreservesLeadingZero -count=1
  • Focused temporal arithmetic and types tests passed.
  • Arithmetic-only mo-tester metadata smoke passed 6/6.
  • git diff --check passed.

Not claimed by this PR: prepared TIME * ? parameter typing, or a full local time.test pass on the arm64 standalone topology. The latter has 12 unrelated out-of-range TIME fixture differences in that environment.

@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 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Force deep review 结果(当前 head c600b2b):

P2:SQL regression 仍未被真实 SQL 路径证明。pkg/sql/plan/function/func_cast_temporal_numeric_test.go:185-225 使用手工构造 decimal,绕过 numeric -> TIME(3) 插入、planner 插入的 cast、constant operand 和 prepared execution,因此 reported SQL failure 仍可能与测试同时存在。请在当前 head 运行 dtype/time.test reproduction,并覆盖 prepared execution;同时验证值和 client-visible decimal type/precision/scale。当前 resolver assertions 只证明内部 metadata,kernel harness 已预分配 expected result type。

P3:边界覆盖较窄,仅有正数、sub-minute、exactly representable values,无法区分 packed HHMMSS 与 elapsed seconds,也未覆盖负小数、minute/hour、rounding-sensitive divisor 和 overflow。可补充这些场景。

六个 arithmetic expected values 本身正确;未发现 timezone/session mutation 或 flakiness。Linux UT 通过,但 SQL BVT skipped。

@XuPeng-SH

Copy link
Copy Markdown
Contributor Author

Follow-up root-cause correction for this PR:

The clean failing CI job 104280571311 was running PR #28825 head 7df20be7d318, not current main or #28957. Its normalizePlainDecimalLiteral path rewrites 0.001 to .001; ParseTime then returns zero before applying the fractional part. The prior function-level test in this PR bypassed that planner boundary, so its green result did not prove the reported BVT issue was fixed.

This update adds the missing binder guard and makes the existing BVT compare the client-visible DECIMAL metadata. It is intentionally a regression guard/test-gap fix; it does not claim to fix the separate prepared TIME * ? (TIME TEXT) typing error or to make the full local time.test green on a topology with different out-of-range TIME behavior.

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

在 exact head 766aa96 上完成 deep review,未发现阻塞问题。已结合旧 head 的 review 和作者的 root-cause correction 核对:本 PR 只补回归覆盖,不宣称 production fix;binder 测试锁定 decimal literal 到 TIME(3) 时保留 0.001/34.5/-0.001 原文,BVT 同时锁定 *、/、% 的结果值与 client-visible DECIMAL type/precision/scale。focused planner/function tests 在 CGO + 本地 thirdparties 环境通过,current-main merge-tree 无冲突。prepared TIME * ? 的独立缺口仍应由后续 issue/PR 处理,但不阻塞这个 test-only guard。

@mergify

mergify Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

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

  • Queue this pull request

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Force deep review 结果(当前 head 766aa96):

此前 real-SQL/metadata P2 已关闭:新增 binder test 覆盖 literal preservation,BVT 验证 values 和 DECIMAL metadata [3,38,3]、[3,38,9]、[3,18,3];exact-head dtype/time.test 为 82/82 passed、zero ignored,Linux UT 通过。

仅保留两个 P3 follow-up:

  1. negative/boundary 覆盖仍不足;binder test 的 -0.001 是 synthetic literal text,arithmetic 仍主要是正数、sub-minute、exact division,未覆盖 SQL sign、packed HHMMSS vs elapsed seconds、rounding、overflow。
  2. prepared execution 未证明;当前 SQL case 主要是 literal operands,建议补 prepare/execute/re-execute 与 client metadata。

未发现 timezone/session mutation、concurrency 或 flakiness 机制;上述 follow-up 不阻塞这个明确范围的历史回归测试。

@XuPeng-SH
XuPeng-SH merged commit 8c7af9a into matrixorigin:main Sep 16, 2026
2 of 5 checks passed
@XuPeng-SH
XuPeng-SH deleted the codex/issue-28953-time-arithmetic-20260916 branch September 16, 2026 04:22
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## What type of PR is this?

- [ ] API-change
- [ ] BUG
- [ ] Improvement
- [ ] Documentation
- [x] Test and CI
- [ ] Feature
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

Refs matrixorigin#28953

## What this PR does / why we need it:

This PR closes the regression-coverage gap for the fractional `TIME(3)`
arithmetic reported by matrixorigin#28953.

The clean failing CI job was run from PR matrixorigin#28825 head `7df20be7d318`, not
from current `main` or this PR. That change normalized the plain decimal
literal `0.001` to `.001`; the subsequent string-to-TIME cast loses the
fraction. Current `main` does not contain that normalizer, so matrixorigin#28957 is
a guard for that historical regression rather than a claim of a new
TIME-kernel production fix.

Changes:

- Add a planner binder regression test that preserves the exact numeric
literal text when binding decimal literals to `TIME(3)`, including
`0.001`, `34.5`, and `-0.001`.
- Mark the existing `TIME(3)` multiply/divide/modulo BVT statements for
metadata comparison.
- Assert client-visible DECIMAL metadata: `[3,38,3]`, `[3,38,9]`, and
`[3,18,3]`, alongside the fractional values.

Validation:

- `go test ./pkg/sql/plan -run
TestBindTimeDecimalLiteralPreservesLeadingZero -count=1`
- Focused temporal arithmetic and `types` tests passed.
- Arithmetic-only mo-tester metadata smoke passed 6/6.
- `git diff --check` passed.

Not claimed by this PR: prepared `TIME * ?` parameter typing, or a full
local `time.test` pass on the arm64 standalone topology. The latter has
12 unrelated out-of-range TIME fixture differences in that environment.
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## What type of PR is this?

- [ ] API-change
- [ ] BUG
- [ ] Improvement
- [ ] Documentation
- [x] Test and CI
- [ ] Feature
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

Refs matrixorigin#28953

## What this PR does / why we need it:

This PR closes the regression-coverage gap for the fractional `TIME(3)`
arithmetic reported by matrixorigin#28953.

The clean failing CI job was run from PR matrixorigin#28825 head `7df20be7d318`, not
from current `main` or this PR. That change normalized the plain decimal
literal `0.001` to `.001`; the subsequent string-to-TIME cast loses the
fraction. Current `main` does not contain that normalizer, so matrixorigin#28957 is
a guard for that historical regression rather than a claim of a new
TIME-kernel production fix.

Changes:

- Add a planner binder regression test that preserves the exact numeric
literal text when binding decimal literals to `TIME(3)`, including
`0.001`, `34.5`, and `-0.001`.
- Mark the existing `TIME(3)` multiply/divide/modulo BVT statements for
metadata comparison.
- Assert client-visible DECIMAL metadata: `[3,38,3]`, `[3,38,9]`, and
`[3,18,3]`, alongside the fractional values.

Validation:

- `go test ./pkg/sql/plan -run
TestBindTimeDecimalLiteralPreservesLeadingZero -count=1`
- Focused temporal arithmetic and `types` tests passed.
- Arithmetic-only mo-tester metadata smoke passed 6/6.
- `git diff --check` passed.

Not claimed by this PR: prepared `TIME * ?` parameter typing, or a full
local `time.test` pass on the arm64 standalone topology. The latter has
12 unrelated out-of-range TIME fixture differences in that environment.

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

3 participants