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]: unify join typed-key canonicalization across resident and spill paths #26432
Follow-up from #26408 and #26412. The ownership/lifecycle fixes in #26412 intentionally do not redesign join-key encoding.
Problem
Resident hash joins, initial spill partitioning, and re-spill must use one SQL-equality canonicalization contract. Today the paths can consistently disagree with SQL equality or with a nested-loop oracle for values such as:
DOUBLE+0 versus -0;
NaN values;
JSON numeric forms such as 1 versus 1.0;
scaled floating-point values;
long VECF32 values containing +0/-0.
Fixing isolated hash functions per type is insufficient: encoding, hashing, equality, partitioning, and rebuild must share the same typed-key contract.
Proposed direction
Define one typed-key codec/canonicalization interface used by resident build/probe, initial spill, re-spill, and remote execution.
Roadmap classification: #26563. Keep this as an independent typed-key correctness change. It must prove identical canonical equality across resident and spill paths, but must not be bundled with planner key selection (#26556), threshold units (#26434), or spill-storage redesign.
go test ./pkg/sql/colexec/hashjoin ./pkg/sql/colexec/dedupjoin ./pkg/sql/colexec/rightdedupjoin \\
-run 'Test(HashJoinKeyEqualityContract|DedupJoin(DoubleSignedZeroContract|RemainingKeyContracts)|RightDedupJoin(DoubleSignedZeroContract|RemainingKeyContracts))$' -count=1
ok hashjoin
ok dedupjoin
ok rightdedupjoin
Activity
fix(join): canonicalize DOUBLE signed zero across spill modes (#26450)
fix(join): enforce typed-key equality across spill and runtime filters (
XuPeng-SH commentedon Aug 1, 2026
Roadmap classification: #26563. Keep this as an independent typed-key correctness change. It must prove identical canonical equality across resident and spill paths, but must not be bundled with planner key selection (#26556), threshold units (#26434), or spill-storage redesign.
fix(frontend): preserve non-finite data branch floats (#26504)
fix(join): complete typed-key semantics for #26432 (#26738)
Ariznawlll commentedon Aug 10, 2026
最新 main 补充探索(resident path)
00cb7ef3169a6c61f358774ac5c690a405ac162d本轮只验证 resident 小数据路径,不作为该 issue 的最终 QA 结论,也不覆盖 spill/re-spill、remote 或多 CN。
DOUBLE 特殊键
表内包含
NULL、-Inf、-1、-0、+0、1、+Inf、两个NaN。a.f=b.fhash join:8 对。a.f<=b.f AND a.f>=b.f:同样 8 对,明细完全一致。-0/+0形成 4 个组合,并排除 NaN。<=>hash join:9 对;在 oracle 中显式加入双 NULL 后也是 9 对。JSON 特殊键
覆盖 JSON 数字
1/1.0/1.00、对象{"a":1,"b":2}/{"b":2,"a":1}、数组和 NULL。<= AND >=oracle:14 对,明细完全一致。VECF32 特殊键
覆盖
[0,-0,1,2]与[-0,0,1,2]、不同尾元素、不同首元素和 NULL。<= AND >=oracle:6 对,明细完全一致。另外在 Sort/Top 路径发现了独立的 NaN 非严格序问题,已单独提交 #26941;它不替代本 issue 的 join typed-key 验收。后续这里仍需按 acceptance criteria 补 resident/spill/re-spill、Hash/Dedup/RightDedup、multi-column、remote/multi-CN 的同一数据集差分。
fix(hashjoin): broadcast const vectors in spill paths (#26938)
Ariznawlll commentedon Aug 11, 2026
最新 main 补充探索:双 CN Remote Hash Join
b84a6627060539173f9ee243e8523792a3ad2200etc/launch-multi-cn/,单 TN/LogService、双 CN(127.0.0.1:16001/:16002)SHOW BACKEND SERVERS显示两个 CN 都为Working。两类语句的EXPLAIN PHYPLAN都是Magic: Remote的 probe Scope + Remote hash-build PreScope,实际走 Hash Join,不是 nested-loop 对照路径。DOUBLE:signed-zero / NaN / infinity
两侧各 4,096 行:
-0/+0各 512,NaN 512,另外-1/1/+Inf/-Inf/42各 512。COUNT(*) = 2,359,296COUNT(*) = 2,359,296(512+512)^2 + 5*512^2,即-0/+0交叉匹配、5 个普通或无穷值桶分别匹配,NaN 不匹配。JSON:数值表示 / 对象键序 / 数组 / NULL
两侧各 4,096 行,包含
1/1.0/1.00,{"a":1,"b":2}/{"b":2,"a":1},两个不同数组和 NULL。COUNT(*) = 3,932,160、SUM(probe.id) = 8,052,539,392VECF32:signed-zero 与 NaN
[0,0,1]与[-0,0,1]:两侧各 2,048 行的 Join 在 CN1/CN2 都为1,310,720,等于(512+512)^2 + 512^2。[1,NaN,3]和 NULL 后:两侧各 1,024 行的 Join 在 CN1/CN2 都为262,144 = (256+256)^2;NaN 和 NULL 均没有形成匹配。spill/re-spill 证据
本轮黑盒 SQL 即使设置
join_spill_mem=1,EXPLAIN ANALYZE仍未输出SpillRows/SpillSize;因此不把该 SQL 标记为实际 spill/re-spill 覆盖。但 latest main 的定向合同测试已在本机通过:
该组测试强制 resident、initial-spill、re-spill 三模式,覆盖 HashJoin、DedupJoin、RightDedupJoin 的 JSON numeric、VECF32 signed-zero/NaN、DOUBLE signed-zero/NaN 等 typed-key 合同。
当前结论
双 CN Remote Hash Join 的上述特殊键黑盒结果正确;resident/spill/re-spill 的三种 join 算子合同测试也通过。仍缺“黑盒 SQL 明确观测到 SpillRows/SpillSize 的特殊键数据集”这一项,故本 comment 不是对本 issue acceptance criteria 的最终 QA 关闭结论。
4 remaining items
fix(join): canonicalize DOUBLE signed zero across spill modes (matrix…
fix(join): enforce typed-key equality across spill and runtime filters (
fix(frontend): preserve non-finite data branch floats (matrixorigin#2…
fix(join): complete typed-key semantics for matrixorigin#26432 (matri…
fix(hashjoin): broadcast const vectors in spill paths (matrixorigin#2…
fix(join): canonicalize DOUBLE signed zero across spill modes (matrix…
fix(join): enforce typed-key equality across spill and runtime filters (
fix(frontend): preserve non-finite data branch floats (matrixorigin#2…
fix(join): complete typed-key semantics for matrixorigin#26432 (matri…
fix(hashjoin): broadcast const vectors in spill paths (matrixorigin#2…
fix(join): canonicalize DOUBLE signed zero across spill modes (matrix…
fix(join): enforce typed-key equality across spill and runtime filters (
fix(frontend): preserve non-finite data branch floats (matrixorigin#2…
fix(join): complete typed-key semantics for matrixorigin#26432 (matri…
fix(hashjoin): broadcast const vectors in spill paths (matrixorigin#2…