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]: IVFFLAT PRE and AUTO retry reject CHAR primary keys as an invalid membership key type #29045
SET experimental_ivf_index =1;
SET probe_limit =1;
CREATEDATABASEivf_char_pk_repro;
USE ivf_char_pk_repro;
CREATETABLEt (
id CHAR(8) PRIMARY KEY,
grp INT,
v VECF32(2)
);
INSERT INTO t VALUES
('c1',1,'[0,0]'),
('c2',1,'[1,0]'),
('c3',2,'[0,1]'),
('c4',2,'[2,0]');
CREATEINDEXix USING IVFFLAT ON t(v)
LISTS=1 OP_TYPE 'vector_l2_ops';
SELECT id FROM t WHERE grp=1ORDER BY l2_distance(v,'[0,0]')
LIMIT10 BY rank WITH OPTION 'mode=pre';
实际结果
ERROR 20400: invalid state required vector membership has invalid cardinality or key type
changed the title [-][Bug]: IVFFLAT mode=pre rejects CHAR primary keys as an invalid membership key type[/-][+][Bug]: IVFFLAT PRE and AUTO retry reject CHAR primary keys as an invalid membership key type[/+]on Sep 17, 2026
Empirically confirmed: keyOid=VARCHAR, exprOid=CHAR, cardinality and nulls are fine — only the strict OID check fails. The
runtime-filter build normalizes the CHAR pk key column to VARCHAR (both share identical varlena bytes; the downstream
membership test is byte-exact). Let me remove the debug and apply the real fix: @iamlinjunhong please take a look
Activity
[-][Bug]: IVFFLAT mode=pre rejects CHAR primary keys as an invalid membership key type[/-][+][Bug]: IVFFLAT PRE and AUTO retry reject CHAR primary keys as an invalid membership key type[/+]Ariznawlll commentedon Sep 17, 2026
补充确认默认
mode=auto也会受影响。在 200 行
CHAR(8) PRIMARY KEY表中,让只有距离较远的 5 行满足谓词。两个 CN 的结果均为:k0191..k0195;invalid state required vector membership has invalid cardinality or key type;因此在 POST 可以直接补满的普通场景里 AUTO 看似正常,但低选择性谓词会让默认 AUTO 进入损坏的 CHAR membership 路径并直接报错。影响不局限于显式指定 PRE 的查询。
cpegeric commentedon Sep 18, 2026
Empirically confirmed: keyOid=VARCHAR, exprOid=CHAR, cardinality and nulls are fine — only the strict OID check fails. The
runtime-filter build normalizes the CHAR pk key column to VARCHAR (both share identical varlena bytes; the downstream
membership test is byte-exact). Let me remove the debug and apply the real fix:
@iamlinjunhong please take a look
Fix IVFFLAT membership metadata and retry filtering (#29835)
Ariznawlll commentedon Oct 12, 2026
测试版本
main;commit:02a2823c2007d5e4fb4ada148e93743df337551a;日期:2026-10-12。experimental_ivf_index=1,probe_limit=1。原问题验证
按 issue 的
CHAR(8) PRIMARY KEY四行表建立IVFFLAT lists=1,mode=pre不再报 runtime membership key type 错误,3/3 返回c1,c2,与force/post/auto/include一致。Happy Path 覆盖
另建 200 行 CHAR 主键表,只有远端
k0191..k0195命中谓词。POST 在本 fixture 下返回空,FORCE、PRE、AUTO 均返回这 5 行;3 轮均通过,实际覆盖 AUTO 在 POST underfill 后的正确性补足,而不只是容易通过的普通 AUTO 查询。Unhappy Path 覆盖
四行表上的不命中
grp=999在全部五种模式均正确返回空集,未把空结果与 membership 丢行混淆;低选择性路径的 FORCE 对照证明五行确实存在。查询完成后连接可继续执行。白盒验证
检查的是 CHAR runtime key 从 IVFFLAT 候选到 PRE membership 的端到端 SQL 结果,以及 AUTO retry 的结果合同;没有仅凭隐表建成来判定修复。未做双 CN 交叉查询或长时压力。
回归测试
已加入 MOTR PR #229,含普通 PRE 和低选择性 AUTO/POST 控制,compare 3/3。小规模确定性键类型问题不需要 big-data。
测试证据
k0191..k0195。测试结论
测试通过。
Ariznawlll commentedon Oct 12, 2026
回归归档:本 issue 在 MatrixOne main
02a2823c2007d5e4fb4ada148e93743df337551a上的原问题、正常与边界/异常路径已有上方详细验证记录,MOTR 对应用例本地 compare 3/3 通过。回归 PR https://github.com/matrixorigin/motr/pull/229 已合入(merge commit0ed4301b164aa42d0affa0dc27e17f7435b7bf04)。据此关闭本 issue;本次关闭未增加先前评论未覆盖的验收范围。测试通过。