Fix floating-point to decimal overflow before narrowing #5525
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.36) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 204 lines diff across 2 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.318
Real PR Conversation Timeline
1 comments
"Review active on #5525"
general
weight: 0.35
gerashegalov
Addresses NVIDIA/cudf-spark#16890.
The floating-point conversion narrowed the rounded coefficient to the destination integer type before checking decimal precision. An overflowing value could wrap into a valid-looking coefficient and pass the bounds check. For example, casting
43000000.0toDECIMAL(9,2)returned50327.04instead of reporting overflow.Keep the rounded magnitude unsigned until precision has been checked, then narrow it and apply the sign. An early input bound prevents overflow during the conversion itself, including the DECIMAL128 path. The bound is computed once per column to avoid unnecessary per-row scaling.
This also corrects the extra-rounding-digit safety check for negative scales and validates the supported scale and precision arguments. The Java API signatures are unchanged.
Validation
26.12.0-SNAPSHOTpackage against the release branch’s pinned cuDF revision.Performance
A matched native microbenchmark of the identical conversion patch, run before retargeting to release/26.12, measured approximately 10–11% higher double-to-DECIMAL32 conversion latency, or 9–10 microseconds per million-row column. Double-to-DECIMAL64 differences were approximately 1–2%, within measurement variation.
AI assistance was used for implementation and testing. The author reviewed and approved the complete changes before posting the PR.