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]: Starlark procedures ignore declared OUT and INOUT types #29155
Starlark procedures do not enforce declared OUT and INOUT parameter types when flushing values back to SQL user variables. Invalid strings are returned from INT parameters, and a value longer than VARCHAR(3) is returned unchanged.
Reproduction
createdatabaseif not exists starlark_out_bug;
use starlark_out_bug;
create procedure p_slk_out(
out oi int,
out ov varchar(3),
inout io int
) language 'starlark'
$$
out_oi ="not-an-int"
out_ov ="too-long"
out_io ="also-not-int"
$$;
set @oi=null, @ov=null, @io=7;
call p_slk_out(@oi, @ov, @io);
select @oi, @ov, @io;
Actual result
The call succeeds and returns:
not-an-int | too-long | also-not-int
This means the declared INT, VARCHAR(3), and INT contracts are all bypassed.
Expected result
Values copied from Starlark to SQL parameters should pass through the same declared-type conversion and width validation used by SQL procedures. Invalid values should reject the call and should not overwrite the caller variables.
Control
The equivalent SQL procedure enforces its declaration:
create procedure p_sql_bad(out oi int)
'begin set oi=''not-an-int''; end';
set @control=99;
call p_sql_bad(@control);
It returns invalid argument cast to int, bad value not-an-int and preserves @control=99. The Starlark procedure behaves differently for the same declared SQL type.
Regression-test placement
Add a parameter-conversion matrix to the Starlark procedure regression suite: all integer widths and signedness, decimal, date/time, binary, vector, VARCHAR(n), NULL, plus valid and invalid OUT/INOUT values. These are small deterministic MOTR cases; no big-data or chaos run is needed.
Activity
fix(frontend): enforce Starlark OUT and INOUT parameter types (#30134)
VioletQwQ-0 commentedon Oct 15, 2026
转测交接:Starlark procedures 执行 OUT/INOUT 声明类型(PR #30134 已合并)
@Ariznawlll 你好,#29155 的修复已通过 PR #30134 合入 main,现按流程转测试验收。
合入信息
fix(procedure): enforce Starlark OUT/INOUT parameter types(final head6cf9bd90030)b5a4d5c7958fe921288f73083eab74dd5609f85e(2026-10-15T07:41:29Z,main)修复范围(对应原 issue 症状)
UINT64_MAX、1<<64可赋给DECIMAL(30,0);超出声明精度按 SQL 转换错误拒绝out_全局变量、合法别名输出的既有行为、未声明mo.setvar转换保持原状;每个别名声明仍被校验验证证据
procedure/starlark_parameter_types.sql正常模式比较 PASS 476/476(0 failed/ignored/abnormal),含独立空表清理断言;既有 Starlark 与 SQL-error BVT PASS 45/45、19/19;focused output/atomicity/array-ownership 测试与完整 frontend 包 PASS;vet/lint/gofmt/diff 检查通过99bf4e6f对应 Actions run 38526355765 对账出 155 条 terminal PASS(含全部向量复用与 typed-nil 子测试),COMPOSE job 选定procedure/starlark_parameter_types.sql报 647/647 成功6cf9bd90030当前检查状态(fresh 查询 2026-10-15T09:0xZ):13 success / 1 cancelled / 20 skipped / 2 neutral;唯一 FAILURE 为MO Checkin Regression On TKE / BUILD MO DOCKER IMAGE(镜像构建基建步骤,与产品行为无关)请验收的场景(PASS/FAIL 预期)
p_slk_out复现语句应使 CALL 被拒绝(invalid argument cast to int类错误),@oi/@ov/@io不被非法值覆盖(对照 SQL 过程 control 行为一致:保留@control=99)VARCHAR(3)超长输出被拒绝;DECIMAL(30,0)接受UINT64_MAX/1<<64、超出精度按 SQL 转换错误b5a4d5c7958f的 main 构建或 nightly,按 issue 原始拓扑 1 LOG / 1 TN / 2 CN 在两台 CN 上各验一轮转测依据:issue 标签
kind/bug+needs-triage,无 compatibility 类标签,按维护约定分配 default tester @Ariznawlll。验证通过后请在本 issue 回复 PASS(注明版本/环境与终态结果),我将据此清理标签并关闭;如 FAIL 请附复现语句与版本,我会加
test-verification-failed并继续修复。Ariznawlll commentedon Oct 15, 2026
测试版本
main8795f3699b40504376343fa1acda8b4619f0c76e。b5a4d5c7958fe921288f73083eab74dd5609f85e已进入上述 main。原问题验证
按 issue 原始 Starlark 过程创建
OUT oi INT、OUT ov VARCHAR(3)、INOUT io INT,过程依次赋值not-an-int、too-long、also-not-int。调用前@oi=NULL, @ov=NULL, @io=7。两个 CN 上各运行 3 次(共 6/6):CALL均因 INT 声明类型转换报错,不再成功返回非法值;调用后两个 OUT 变量仍为 NULL,INOUT 仍为 7。Happy Path 覆盖
OUT INT字符串"12"转换为整数 12,OUT VARCHAR(3)返回abc,INOUT INT从 7 更新为 8;每 CN 3/3。OUT INT = None将调用方变量置为 NULL;每 CN 3/3。INOUT从 99 正常更新为 100;每 CN 3/3。Unhappy Path 覆盖
OUT TINYINT = 128返回 out-of-range 错误,调用方原值 99 保持不变;每 CN 3/3。OUT VARCHAR(3) = 'too-long'返回宽度校验错误,调用方原值old保持不变;每 CN 3/3。OUT INT = 'not-an-int':CALL报 INT 转换错误;表中行数仍为 0,调用方变量仍为 99,证明该失败回滚 SQL 副作用且不部分覆盖参数;每 CN 3/3。白盒验证
本次没有另跑 Go UT /
-race;重点使用与原 issue 相同的双 CN 拓扑做黑盒行为及事务原子性验收。开发在 #30134 记录了更完整的整数宽度、DECIMAL、时间、binary、vector 和 NULL 矩阵及两轮 476/476 BVT;这是开发自测证据,不计入本次独立运行次数。回归测试
script/14_issue_regression/issue_29155_starlark_output_types.py及配套.out。它保留原始复现,断言错误诊断、调用方变量、合法类型转换、NULL、溢出、VARCHAR 长度、SQL 副作用回滚和错误后恢复。total=3 success=3 failed=0;CN1 同样total=3 success=3 failed=0。PR 尚未合并,完整 suite 与集成 CI 未验证,后续继续跟踪。测试证据
测试结论
测试通过。