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
[Bug]: DATE/DATETIME/TIME use incorrect numeric coercion in bitwise and scalar functions #31904
Consolidating #31906 here under one numeric-coercion contract for DATE/DATETIME/TIME operands. Preserve both families: bitwise &, |, ^ must produce numeric results (not binary garbage), and numeric scalar consumers such as BIT_COUNT/SEC_TO_TIME must use MySQL temporal-to-number conversion, including warnings and TIME overflow behavior. These are distinct call paths and need separate assertions under the shared contract.
changed the title [-][Bug]: bitwise & | ^ on DATE/DATETIME/TIME return 255-byte binary garbage instead of numeric results[/-][+][Bug]: DATE/DATETIME/TIME use incorrect numeric coercion in bitwise and scalar functions[/+]on Nov 9, 2026
Activity
XuPeng-SH commentedon Nov 9, 2026
Consolidating #31906 here under one numeric-coercion contract for DATE/DATETIME/TIME operands. Preserve both families: bitwise
&,|,^must produce numeric results (not binary garbage), and numeric scalar consumers such asBIT_COUNT/SEC_TO_TIMEmust use MySQL temporal-to-number conversion, including warnings and TIME overflow behavior. These are distinct call paths and need separate assertions under the shared contract.[-][Bug]: bitwise & | ^ on DATE/DATETIME/TIME return 255-byte binary garbage instead of numeric results[/-][+][Bug]: DATE/DATETIME/TIME use incorrect numeric coercion in bitwise and scalar functions[/+]gouhongshen commentedon Nov 12, 2026
PR #32642 is trying to fix this issue.
fix: correct temporal numeric coercion for bit consumers (#32642)
XuPeng-SH commentedon Nov 17, 2026
转 QA 验证,非验收通过;本 issue 保持开放。
关联修复 #32642 已于 2026-11-17 00:05 UTC 合入 main,merge SHA:e765c5fd44e842167d4271c37af6d25586511e16。已核对本 issue 完整评论、合并跟踪的 #31906 及 PR 修复范围/讨论,未发现当前适用的已验证反例或未完成开发 follow-up。
作者报告的验证包括:temporal_numeric_consumer 57/57(两轮)、BIT_COUNT 210/210、SEC_TO_TIME 33/33 等相关 SQL BVT,完整 planner/function 包及原生 prepared 协议验证;最终 CI Required 已满足合入条件。本轮仅核对远端材料,未重复运行本地或部署测试。
请 @Ariznawlll 在包含该 SHA 的版本上分别验证:
边界:原生 Connector/Python timedelta 验证应使用纯编码器(use_pure=True);PR 说明可选 9.4.0 C 编码器会生成异常 TIME payload。既有 prepared BIT_COUNT DOUBLE 极值差异不在本次时间类型修复范围。若发现当前反例,请附精确版本、最小 SQL/协议参数及实际输出再转回开发。
gouhongshen commentedon Nov 17, 2026
PR #32642 has merged and is awaiting manual validation. The issue remains open.
Ariznawlll commentedon Nov 17, 2026
测试版本
e765c5fd44e842167d4271c37af6d25586511e16,运行实例git_version()=e765c5fd44。use_pure=True;测试日期:2026-11-17。原问题及 SQL 契约
temporal_numeric_consumer.test已完整复跑:57/57 成功,0 失败。01:02:03 -> 10203(BIT_COUNT=10,&3=3),02:50:03 -> 25003(BIT_COUNT=8,&3=3),00:00:00.500000 -> 1(BIT_COUNT=1,&3=1)。+08:00/-05:00分别得到20240101100000/20240101180000/20240101050000;DATETIME 保持原数值。普通文本与 binary prepared 读取均一致。原生 prepared 重绑定
同一 statement id 上按顺序验证 8 次绑定:
2024-01-01→ 7,独立普通 cursor 执行SHOW WARNINGS得 1292;7/8. 两组原生 TIME → 10 / 8。
statement id 在整个序列中保持不变;另以 4 组原生 TIME 参数及显式 SQL 对照核对,避免客户端编码错误成为 oracle。
范围归类与白盒
fresh prepared cursor 首次绑定文本
2024-01-01得到 BIT_COUNT=29、无 warning,是 prepared 初始参数采用 binary overload、对十个 ASCII 字节计位的既有契约;数值 latch 后的文本重绑定才得到 7 + warning 1292。核对了pkg/sql/plan/prepared_binding.go、pkg/frontend/prepared_execution.go、pkg/frontend/computation_wrapper.go及 function 定义;该 fresh-text 对照早于本次 temporal 修复且已有测试固定,不作为本 issue 反例。此前手工 TIME oracle 的误报已撤回。回归测试
已追加 matrixorigin/motr#349:
14_issue_regression.issue_31904_temporal_numeric_protocol,需MOTR_MYSQL_CONNECTOR_TESTS=1显式启用,覆盖 latch 重绑定、warning、TIME、TIMESTAMP 及 fresh-text 独立对照。新增提交
01ba5603bedc5f1bcb82ac91c0d1635fa59b27db;本批四用例录制后独立复跑,显式启用协议用例后--repeat 3合计 12/12 用例、159/159 调度语句通过,零 SKIP;PR 新 head 的 4 项 CI 全部 SUCCESS。测试结论
本 issue 及合并跟踪的 #31906 范围内验证通过,关闭本 issue。