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 DIFF OUTPUT LIMIT 0 returns one row #26034
DATA BRANCH DIFF ... OUTPUT LIMIT 0 returns one diff row instead of an empty result.
Version
Branch: main
Commit: e15943929885c2c5c83daed90f0f8caeb9a1f0d0
Reproduction
DROPDATABASE IF EXISTS g4d_limit;
CREATEDATABASEg4d_limit;
USE g4d_limit;
CREATETABLEbase(id INTPRIMARY KEY, v INT);
INSERT INTO base VALUES (1,10),(2,20),(3,30);
DATA BRANCH CREATE TABLE child FROM base;
UPDATE child SET v = v +1;
INSERT INTO child VALUES (4,40);
DATA BRANCH DIFF child AGAINST base OUTPUT LIMIT0;
The result contains one row, for example:
diff child against base flag id v
child UPDATE 1 11
The behavior reproduced in 3 out of 3 clean runs. OUTPUT LIMIT 1 and OUTPUT LIMIT 2 returned one and two rows respectively, and a negative limit was rejected by the parser.
Expected behavior
OUTPUT LIMIT 0 should return zero rows.
Actual behavior
OUTPUT LIMIT 0 returns one row.
Code observation
In satisfyDiffOutputOpt, the current row is appended before the limit condition is checked. For a zero limit, the first row is therefore added before the producer is stopped.
Activity
fix(frontend): honor zero data branch diff limits (#26540)
gouhongshen commentedon Aug 2, 2026
fixed
Ariznawlll commentedon Aug 4, 2026
测试版本
mainc58cd292d3e6e039a8882654d3b20ad345171e87原问题验证
重跑
DATA BRANCH DIFF ... OUTPUT LIMIT 0,结果稳定返回 0 行差异,没有退化为无限制输出。相同用例连续执行 3 轮,结果一致。Happy Path 覆盖
LIMIT 0、1、n-1、n、n+1,返回行数均符合边界定义。LIMIT n和LIMIT n+1均返回完整差异集,源表和 branch 内容保持不变。Unhappy Path 覆盖
白盒验证
执行
TestDataBranchOutputLimitBoundaries定向测试,覆盖0、最大合法值及边界转换;连续执行 3 轮通过。回归测试
test/distributed/cases/git4data/branch/edge/branch_output_limit_zero.sql测试证据
LIMIT 0的分布式 BVT 和前端边界 UT。测试结论
测试通过。
Ariznawlll commentedon Aug 4, 2026
测试版本
mainc726a6199094184a2e6ebc7504c3e011982b8976原问题验证
重新执行
DATA BRANCH DIFF ... OUTPUT LIMIT 0,完整行和 projection 两种输出均只返回表头、不返回差异行;完整 motr 边界矩阵连续执行 3 轮通过。Happy Path 覆盖
Unhappy Path 覆盖
9223372036854775808越界 literal 被 SQL parser 拒绝。白盒验证
不适用:本次补充通过真实 DIFF 输出和读后状态验证 LIMIT 边界。
回归测试
测试证据
12_git4data.issue_26034_26056_output_limit:26 条语句全部成功,连续 3 轮 baseline 一致。测试结论
测试通过。
fix(frontend): honor zero data branch diff limits (matrixorigin#26540)
fix(frontend): honor zero data branch diff limits (matrixorigin#26540)
fix(frontend): honor zero data branch diff limits (matrixorigin#26540)