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
Explicit prepared DOUBLE casts still disable DECIMAL block pruning #29516
On #29508 head e0082f4be0, create a DECIMAL table with 100,000 rows in 13 blocks:
createtablet(d decimal(18,2));
insert into t select result from generate_series(1,100000) g;
With a binary prepared float64(54321) binding, select count(*) from t where d=? reads one block (~1.5 ms per execution), but select count(*) from t where d=cast(? as double) reads all 13 (~50 ms per execution). SQL PREPARE with @v=cast(54321 as double) confirms the latter plan has cast(t.d AS DOUBLE) = cast(cast('54321' AS DOUBLE) AS DOUBLE) and no block filter.
The equivalent explicit DOUBLE(M,D) cast also scans all 13 blocks. Both forms return the correct count. Unlike a direct DOUBLE marker, the explicit CAST operand follows prepared text transport, so preserving its exact conversion and rounding behavior is necessary before applying DECIMAL filter pushdown.
Expected
When the evaluated explicit CAST value uniquely maps to one DECIMAL value at the column scale, retain a native DECIMAL scan filter. Preserve current results and fallback for fractional values, malformed text, NULL, nonfinite values, precision rounding, and 2^53 collision cases. Reuse the current optimizer and prepared binding owners.
Activity
fix: preserve prepared ROUND and TRUNCATE value domains (#29508)
Ariznawlll commentedon Oct 2, 2026
测试版本
maind50a2d475a406829f67127fef7b2ad4abc1c1d3dmo-service,独立数据目录;MySQL 文本协议与 server-side PREPARE原问题验证
按 issue 原始语义在上述 commit 重新执行并重复 3 次。DOUBLE marker 与 DECIMAL key 比较保留 native DECIMAL block filter,目标行与 direct SQL 一致。
Happy Path 覆盖
覆盖等值、BETWEEN、IN 及多次浮点重绑。
Unhappy Path 覆盖
覆盖 NaN/Inf、NULL、超 scale 和无法精确表示值;不生成不安全 filter。
白盒验证
关联修复 #29508 已进入当前
main。同时将本 issue 的可公开观察契约固化为独立回归,避免只依赖实现细节或共享测试间接判断。回归测试
suites/14_issue_regression/t/issue_recent_pruning_contracts.test714/714条语句通过。测试证据
d50a2d475a406829f67127fef7b2ad4abc1c1d3d14_issue_regression中观察到的旧 GOROOT/历史 golden/并发锁冲突属于既有无关失败,以上新增用例单独重跑均稳定通过。测试结论
测试通过。