MDEV-39366 Preserve DOUBLE precision when caching subquery results #5768
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.32) × (1 − Review Confidence (0.43)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.32 · 136 lines diff across 1 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.294
Real PR Conversation Timeline
1 comments
"Review active on #5768"
general
weight: 0.35
gkodinov
A correlated scalar subquery using STDDEV_POP() can return a full-precision value on a cache miss and a rounded value on cache hits. The temporary DOUBLE result field applies the expression's declared scale when storing the evaluated result.
Preserve the evaluated DOUBLE value in the subquery cache. Add one correlated query over the values 0, 0 and 1 to cover both cache misses and hits. Casting the result to DECIMAL(10,8) exposes the precision loss with stable expected output: 0.47140452 for all three rows.
Bug report: https://jira.mariadb.org/browse/MDEV-39366
Validation
On current
11.4atf49e838d367f2154b3edb43effa99ff9eb0d8602:main.subselect_cachematch.main.subselect_cache,main.select.main.subselect_cachealso passes with the prepared-statement protocol.