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]: MongoDB external table accepts unsupported SET type #27259
Activity
Ariznawlll commentedon Aug 18, 2026
补充测试版本
TKE 复现
在已有合法 MongoDB connection 的管理员会话中,连续 3 次创建 SET 外表:
CREATE EXTERNAL TABLE .gap_set_control_(v SET('a','b') MONGODB_PATH 'v' MONGODB_CONVERT 'strict') ENGINE=MONGODB WITH (...);
实际结果:3/3 建表成功,并在 mo_catalog.mo_mongodb_tables 中各产生 1 条 Mongo mapping;按设计 unsupported 类型应在 DDL/plan 阶段拒绝且不产生 mapping。
随后使用数值 BSON 字段映射的 SET 外表执行 SELECT,实际返回:
ERROR 20101 (HY000): internal error: convert to MySQL set failed: value 42 overflow set boundary 3
控制组
以下类型各执行 3 次,均在建表阶段拒绝:BIT(1) 3/3;TIME 3/3;YEAR 3/3;ENUM 3/3;UUID 3/3。
根因证据
supportedMOType 只允许基础数值、时间、字符串、二进制和 JSON 类型;但 parser/plan 会将 MySQL SET 转成内部 uint64,导致 Mongo converter 误判为已支持的 UINT 类型。相关位置:pkg/sql/plan/build_util.go 的 SET 类型映射,以及 pkg/sql/mongodb/converter.go 的 supportedMOType。
清理与控制
测试结论:测试不通过。
fix(mongodb): reject SET external table columns (#27271)
Ariznawlll commentedon Sep 1, 2026
测试版本
main@33af6ae3c0c23e4f277137460577ea64678f7ecf原问题验证
MongoDB external table 的
SET列现会在访问外部数据前稳定返回ERROR 20105: not supported: MongoDB mapping target type SET,不再错误接受 DDL。Happy Path 覆盖
NOT NULL与strict/try_null交叉矩阵,共 4 种 DDL,均走统一、明确的 unsupported type 路径。Unhappy Path 覆盖
mo_catalog.mo_tables和mo_catalog.mo_mongodb_tables,目标 table/mapping 残留计数均为0,拒绝具有原子性。白盒验证
不适用。类型门禁发生在 DDL 阶段,不需要构造 MongoDB 或网络故障。
回归测试
issue_27259_mongodb_set_rejection.test/.result。测试证据
191/191SQL、重复 3 轮573/573SQL 通过。测试结论
测试通过。
fix(mongodb): reject SET external table columns (matrixorigin#27271)
fix(mongodb): reject SET external table columns (matrixorigin#27271)
fix(mongodb): reject SET external table columns (matrixorigin#27271)