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]: PAD SPACE CHAR set operations return wrong UNION/INTERSECT/MINUS results #28952
The failing fixture is test/distributed/cases/dtype/pad_char_to_full_length.sql:
CREATETABLEpad_char_set8 (c CHAR(8));
CREATETABLEpad_char_set4 (c CHAR(4));
INSERT INTO pad_char_set8 VALUES ('MO');
INSERT INTO pad_char_set4 VALUES ('MO');
SELECTCOUNT(*) FROM
(SELECT c FROM pad_char_set8 UNIONSELECT c FROM pad_char_set4) u;
SELECTCOUNT(*) FROM
(SELECT c FROM pad_char_set8 INTERSECT SELECT c FROM pad_char_set4) i;
SELECTCOUNT(*) FROM
(SELECT c FROM pad_char_set8 MINUS SELECT c FROM pad_char_set4) m;
Expected results:
UNION 1
INTERSECT 1
MINUS 0
Observed results:
UNION 2
INTERSECT 0
MINUS 1
The reverse-order UNION cases also return both an unpadded length-4 value and a padded length-8 value, instead of one PAD SPACE-equivalent result.
Expected behavior
CHAR values that differ only by trailing PAD SPACE should use one consistent equality/key normalization across UNION, INTERSECT, and MINUS. Mixed CHAR widths must not create distinct set keys solely because the physical padded lengths differ.
Attribution
The failing PRs do not modify this CHAR set-operation path. This is a base/shared PAD SPACE semantics regression.
Related #28024 covers PAD SPACE loss for COALESCE/IFNULL expression keys, and #27525 covered parallel INTERSECT duplicate keys; this issue is the direct mixed-width CHAR set-key failure.
Activity
test(plan): cover mixed-width CHAR set operations (#28956)
Ariznawlll commentedon Sep 17, 2026
测试版本
main8e8e1998ef02b1f6233ddb1c2d3208f3b70d2d83原问题验证
使用
CHAR(8)与CHAR(4)的相同文本值MO复现集合运算。UNION、INTERSECT、MINUS均返回正确基数(1、1、0),交换左右输入后结果保持一致,未再发生 PAD SPACE 语义丢失或误判为不相等。Happy Path 覆盖
覆盖
UNION、INTERSECT、MINUS及两种 operand 顺序。Unhappy Path 覆盖
不适用:该问题是等值语义错误,不存在独立的失败输入;双向
MINUS为非匹配结果的反向控制。白盒验证
不适用:以 SQL 结果和交换操作数后的语义不变性作为黑盒验收。
回归测试
已加入 MOTR PR #181:
issue_28952_28897_character_coercion.test。本地连续 3 轮通过。测试证据
motr --repeat 3 14_issue_regression.issue_28952_28897_character_coercion:3/3 通过,21 条 SQL/轮均成功。测试结论
测试通过。
test(plan): cover mixed-width CHAR set operations (matrixorigin#28956)
test(plan): cover mixed-width CHAR set operations (matrixorigin#28956)