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]: Data Branch SQL materialization cannot preserve NaN and infinity float values #26072
Data Branch operations that materialize rows through generated SQL cannot write valid DOUBLE values representing NaN or positive/negative infinity.
Plain DATA BRANCH DIFF returns these values correctly, but DIFF ... OUTPUT AS, MERGE, and PICK convert them to bare NaN, +Inf, or -Inf tokens. Those tokens are parsed as column expressions rather than floating-point values.
Tested at commit 2eb7f523e5a10f352d3e258183ed8440510388de.
Steps to reproduce
dropdatabase if exists g4d_float_branch;
createdatabaseg4d_float_branch;
use g4d_float_branch;
createtablebase_t(id intprimary key, f double);
insert into base_t values (1,1.5);
data branch create table src_t from base_t;
data branch create table dst_t from base_t;
insert into src_t values
(2,cast('NaN'as double)),
(3,cast('Inf'as double)),
(4,cast('-Inf'as double));
-- This returns all three rows correctly.
data branch diff src_t against dst_t;
-- These fail when the values are materialized through generated SQL.
data branch diff src_t against dst_t output as diff_out;
data branch merge src_t into dst_t;
PICK fails in the same way on a fresh source/destination pair:
insert into pick_src values (2,cast('NaN'as double));
data branch pick pick_src into pick_dst keys(2);
Actual behavior
Plain DIFF returns NaN, +Infinity, and -Infinity.
OUTPUT AS fails with an error such as ambiguous column reference 'Inf'; the incomplete result table is cleaned up.
MERGE fails with the same class of error and leaves the destination unchanged.
PICK fails on NaN and leaves the destination unchanged.
Expected behavior
Every Data Branch operation should preserve all floating-point values accepted by MatrixOne. Generated SQL should use a representation that round-trips NaN and both infinity values, such as an explicit cast from a quoted value.
Reproducibility
Reproduced in 3/3 runs for OUTPUT AS, MERGE, and PICK. Plain DIFF succeeded in all runs.
Code context
formatValIntoString in pkg/frontend/data_branch_helpers.go formats FLOAT and DOUBLE with strconv.AppendFloat. Finite values are valid numeric literals, but the special outputs NaN, +Inf, and -Inf are appended without quoting or an explicit cast. The same formatter feeds OUTPUT AS and the MERGE/PICK SQL appenders.
Activity
gouhongshen commentedon Jul 31, 2026
The verified fix is available in Draft PR #26504.
gouhongshen:agent/issue-26072matrixorigin:maindaa66193a10ef3b934c99661e01b1a7499a15363The local branch, fork branch, and PR head currently resolve to the same commit.
gouhongshen commentedon Aug 4, 2026
fixed
Ariznawlll commentedon Aug 7, 2026
测试版本
mainab49099c0f487255df131f45c3aecf4a4650fed7原问题验证
执行现有
branch_float_special_values.sql的 DIFF OUTPUT AS、MERGE、PICK 场景:带主键表的NaN、+Inf、-Inf特殊浮点值均可正确保留,连续 3/3 通过;完整当前 BVT 也通过(仅出现用例定义的预期 conflict error)。Happy Path 覆盖
NaN、+Inf、-Inf在 branch 的 DIFF OUTPUT AS、MERGE、PICK 路径均通过,连续 3/3 输出一致。-Inf保留路径在扩展场景中也保持正确。Unhappy Path 覆盖
NaN(应删除)、+Inf(应更新)、-Inf(应保留);branch merge 后查询结果同时存在NaN remove、+Inf update和+Inf updated。NaN remove并以+Inf updated替换+Inf update;实际删除和更新均残留旧行,属于错误数据物化。白盒验证
不适用。本次失败可由 Git4Data 的公开 branch/merge SQL 稳定复现,已包含带主键的通过控制与无主键的失败对照。
回归测试
已执行现有 BVT(见上方链接)及本地无主键扩展 SQL,未新增回归用例:当前实现存在确定性错误。修复后建议在
branch_float_special_values.sql增加无主键的NaN/+Inf/-Infmerge,并断言旧行被删除而不是更新后并存。测试证据
NaN remove和+Inf update两条旧记录,同时新增+Inf updated。main;发布评论时 currentmain为8824b6c7f4549dfdc6fce37fec4c0002ce703b3e,与测试提交相差 1 个不涉及 FILL/Git4Data 文件的 commit。测试结论
测试不通过。
fix(frontend): use hidden fake pk type for data branch lca probe (#26795
gouhongshen commentedon Aug 11, 2026
fixed again
Ariznawlll commentedon Aug 12, 2026
测试版本
main1c292cf20e113b296a3db2cb6a65e00af2ea2327etc/launch-with-proxy/launch.toml,2 CN / 1 TN / 1 Log + Proxy;本用例直连 CN16001原问题验证
分别创建带主键和不带主键的源/目标 DATA BRANCH 表,将
FLOAT、DOUBLE的NaN、+Inf、-Inf、有限值和NULL组合写入更新、插入和删除差异,再执行DATA BRANCH DIFF ... OUTPUT AS、MERGE和PICK。原问题中的非有限浮点值均能被物化并写回:例如主键路径得到nan/inf、inf/-inf、NULL/NULL和-inf/nan,未出现 SQL 拼接或转换错误。完整用例连续执行 3/3 次,结果一致。Happy Path 覆盖
DIFF OUTPUT AS正确产生 3 条UPDATE和 1 条INSERT;MERGE后 5 行的有限值、NaN、正负无穷和NULL均与源表一致。MERGE后只保留keep、两条更新行及新插入行,已删除行没有残留。PICK ... KEYS(2,3,4)使用全新分支独立验证,目标表最终包含未修改控制行和三条带nan/inf、inf/-inf、-inf/nan的指定行。Unhappy Path 覆盖
MERGE,稳定返回错误码20101。(1,'keep',1.0,2.0)和(2,'destination',9.0,NULL);源中的(3,'must_not_apply',-Inf,NaN)未被部分写入,验证拒绝原子性。白盒验证
不适用:该问题是 DATA BRANCH 通过公开 SQL 物化
FLOAT/DOUBLE字面量的端到端行为,风险同时跨越DIFF OUTPUT AS、MERGE、PICK和无主键匹配;使用真实 SQL 引擎的 Git4Data 黑盒回归可以直接验证最终行值和冲突原子性。回归测试
已加入 motr PR #106:
issue_26072_special_float_materialization.test。聚焦用例重复 3 次均通过;完整12_git4data套件结果为73 success / 0 failed / 1 expected opt-in skip。测试证据
issue_26072_special_float_materialization.result27 success / 0 failed、306/306 statements。测试结论
测试通过。
fix(frontend): use hidden fake pk type for data branch lca probe (mat…
fix(frontend): use hidden fake pk type for data branch lca probe (mat…
fix(frontend): use hidden fake pk type for data branch lca probe (mat…