You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Compatibility]: TIMESTAMPADD SECOND rounds DECIMAL intervals to whole seconds #30203
CREATETABLEdecimal_tsadd_generated(
id INTPRIMARY KEY,
dt DATETIME(6),
n DECIMAL(2,1),
calc DATETIME(6) AS (TIMESTAMPADD(SECOND,n,dt)) STORED,
INDEX idx_calc(calc)
);
INSERT INTO decimal_tsadd_generated(id,dt,n) VALUES
(1,'2024-01-01 00:00:00.000000',1.4),
(2,'2024-01-01 00:00:00.000000',1.5),
(3,'2024-01-01 00:00:00.000000',1.6);
SELECT id,calc FROM decimal_tsadd_generated ORDER BY id;
SELECT id FROM decimal_tsadd_generated
WHERE calc='2024-01-01 00:00:01.500000';
Regression and extended verification for #30203 (2026-10-22)
Verification Environment
Source: latest origin/main, commit c232b6d2a1b5a94ac624c4954586569841c1e153, title Fix mixed JSON and numeric comparisons (#30707). The MatrixOne binary was built from this commit with Go 1.27.1.
Topology: 2 CN / 1 TN / 1 LogService / Proxy.
Proxy 6821, CN1 16121, and CN2 16122 were each reachable and tested directly.
Client: MySQL CLI over the MySQL client protocol. Prepared execution used server-side PREPARE/EXECUTE. Reference: MySQL 8.0.46. Comparison sessions used timezone +00:00 and matching sql_mode where applicable.
What Was Covered
OK — Original DECIMAL-second behavior with positive and negative column values (1.4, 1.5, 1.6, -1.4, -1.5, -1.6) matches MySQL on Proxy, CN1, and CN2; fractional seconds are preserved.
OK — DECIMAL literal and server-side prepared execution with -1.5 match MySQL.
OK — NULL propagation, integer/DOUBLE/string controls, and the MICROSECOND control match MySQL.
OK — Boundary checks including 0.000001, sub-microsecond 0.0000009, and carry across the year boundary match MySQL.
OK — Out-of-range overflow returns NULL with warning code 1441 on both systems.
OK — STORED generated-column values match; the FORCE INDEX(added_idx) lookup returns id=2 on all MatrixOne endpoints and MySQL. MatrixOne's plan uses an Index Table Scan on added_idx.
Not covered — The complete distributed BVT harness was not run. The targeted SQL cases above were executed directly against the running service.
Findings
The associated fix is merged PR #30286, merge commit 743e749a1e33d6c845bb73999e8c82d297a2b657, titled fix(sql): preserve fractional TIMESTAMPADD SECOND intervals. It preserves fractional TIMESTAMPADD(SECOND, ...) values through typed normalization and execution paths.
The current test/distributed/cases/function/func_datetime_timestampadd.result expects no row for the FORCE INDEX(added_idx) lookup, while direct execution on latest main and MySQL both return id=2. This is a stale expected-result artifact, not a remaining runtime failure. No MatrixOne source or test file was modified. No new MOTR case was needed because the existing distributed SQL test covers the behavior.
Large-data regression is not needed: this is deterministic temporal arithmetic precision, independent of data volume.
MOTR / BVT Coverage
The relevant coverage exists in test/distributed/cases/function/func_datetime_timestampadd.test. Its targeted cases were exercised directly across Proxy/CN1/CN2, including the generated-column/index path. The full BVT harness was not run; the checked-in .result expectation for the forced-index lookup should be updated before claiming a full BVT pass. No MOTR test or commit was added.
Final Conclusion
Fixed — the reported fractional-second loss in TIMESTAMPADD(SECOND, DECIMAL, ...) is fixed on latest main and matches MySQL 8.0.46 across Proxy, CN1, and CN2. The only remaining item is the stale distributed-test expected result described above; it does not change the runtime conclusion.
Activity
Ariznawlll commentedon Oct 14, 2026
补充生成列 + 二级索引交叉:
MatrixOne 保存
01.000000, 02.000000, 02.000000秒,MySQL 8.0.46 保存01.400000, 01.500000, 01.600000秒。查询calc='...01.500000'在 MO 无结果、MySQL 返回id=2;MO 执行计划使用idx_calc。这确认 DECIMAL 秒小数丢失会进入 STORED generated value 和索引查找结果。Ariznawlll commentedon Oct 14, 2026
补充 SQL PREPARE 复用验证:
PREPARE ts_add FROM SELECT TIMESTAMPADD(SECOND, ?, CAST(... AS DATETIME(6)))后分别以DECIMAL(2,1)的1.5和-1.5执行,MO 结果为+2.000000s/-2.000000s,MySQL 8.0.46 为+1.500000s/-1.500000s。直接 SELECT、DECIMAL 列、SQL PREPARE 三条路径同向复现。Ariznawlll commentedon Oct 14, 2026
补充 interval 参数静态类型对照:
MO 分别返回
02.000000、01.000000、01.000000;MySQL 8.0.46 三种输入均返回01.500000。因此 MO 的 DECIMAL 路径将小数秒舍入为整数秒,DOUBLE/字符串路径则截掉小数秒;MySQL 均保留到微秒。原 issue 中 DECIMAL 列结果与此一致。Ariznawlll commentedon Oct 14, 2026
邻近函数控制:
DATE_ADD/DATE_SUB的 DECIMAL SECOND interval检查同一秒级 DECIMAL interval 在相邻 API 中的行为,发现
DATE_ADD/DATE_SUB/ADDDATE当前保留小数秒,与 MySQL 一致:MatrixOne
8.0.30-MatrixOne-v1.3.0与 MySQL 8.0.45 分别得到00:00:01.400000、前一日23:59:58.600000、00:00:00.000001和00:00:01.500000。这组控制把当前差异进一步限定在TIMESTAMPADD(SECOND, DECIMAL, ...)路径,并未发现DATE_ADD/SUB的同类值差异。slyunnn commentedon Oct 22, 2026
Regression and extended verification for #30203 (2026-10-22)
Verification Environment
origin/main, commitc232b6d2a1b5a94ac624c4954586569841c1e153, titleFix mixed JSON and numeric comparisons (#30707). The MatrixOne binary was built from this commit with Go1.27.1.2 CN / 1 TN / 1 LogService / Proxy.6821, CN116121, and CN216122were each reachable and tested directly.PREPARE/EXECUTE. Reference: MySQL8.0.46. Comparison sessions used timezone+00:00and matchingsql_modewhere applicable.What Was Covered
1.4,1.5,1.6,-1.4,-1.5,-1.6) matches MySQL on Proxy, CN1, and CN2; fractional seconds are preserved.-1.5match MySQL.NULLpropagation, integer/DOUBLE/string controls, and theMICROSECONDcontrol match MySQL.0.000001, sub-microsecond0.0000009, and carry across the year boundary match MySQL.NULLwith warning code1441on both systems.FORCE INDEX(added_idx)lookup returnsid=2on all MatrixOne endpoints and MySQL. MatrixOne's plan uses anIndex Table Scanonadded_idx.Findings
The associated fix is merged PR #30286, merge commit
743e749a1e33d6c845bb73999e8c82d297a2b657, titledfix(sql): preserve fractional TIMESTAMPADD SECOND intervals. It preserves fractionalTIMESTAMPADD(SECOND, ...)values through typed normalization and execution paths.The current
test/distributed/cases/function/func_datetime_timestampadd.resultexpects no row for theFORCE INDEX(added_idx)lookup, while direct execution on latest main and MySQL both returnid=2. This is a stale expected-result artifact, not a remaining runtime failure. No MatrixOne source or test file was modified. No new MOTR case was needed because the existing distributed SQL test covers the behavior.Large-data regression is not needed: this is deterministic temporal arithmetic precision, independent of data volume.
MOTR / BVT Coverage
The relevant coverage exists in
test/distributed/cases/function/func_datetime_timestampadd.test. Its targeted cases were exercised directly across Proxy/CN1/CN2, including the generated-column/index path. The full BVT harness was not run; the checked-in.resultexpectation for the forced-index lookup should be updated before claiming a full BVT pass. No MOTR test or commit was added.Final Conclusion
Fixed — the reported fractional-second loss in
TIMESTAMPADD(SECOND, DECIMAL, ...)is fixed on latest main and matches MySQL8.0.46across Proxy, CN1, and CN2. The only remaining item is the stale distributed-test expected result described above; it does not change the runtime conclusion.