fix: width_bucket places an infinite value outside the range #426
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.37) × (1 − Review Confidence (0.43)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 239 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.328
Real PR Conversation Timeline
1 comments
"Review active on #426"
general
weight: 0.35
andygrove
<!--
SPDX-License-Identifier: Apache-2.0
SPDX-FileCopyrightText: See the NOTICE file distributed with this work for additional information regarding copyright ownership
SPDX-FileContributor: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements
-->
Which issue does this PR close?
Rationale for this change
width_bucketreturns NULL when the value isInfinityor-Infinity. Spark returnsnum_buckets + 1forInfinityand0for-Infinity, becauseWidthBucket.computeBucketNumberreturns NULL only for a NaN value, and for a NaN or infiniteminormax. An infinite value is handled by the normal below-min and above-max checks.What changes are included in this PR?
docs/functions/scalar/math.mdis regenerated withdev/update_function_docs.sh.Are these changes tested?
Yes.
math/width_bucket.slthas new cases forInfinityand-Infinityas the value, withmin < maxandmin > max, and for an infiniteminandmax. Without the kernel change the infinite-value cases return NULL; with it the wholewidth_bucket.sltpasses, both with and withoutsimplify.The expected results are the ones in #424, which reports PySpark 4.2.0 and 3.5.9. I did not run Spark myself. I also ran
cargo fmt --all,cargo clippy --all-targets --all-features -- -D warningsandcargo test -p datafusion-spark-sqllogictest.Are there any user-facing changes?
Yes.
width_bucketnow returns Spark's result for an infinite value instead of NULL.---
AI assistance: this change was prepared with Claude Code.
🤖 Generated with Claude Code
https://claude.ai/code/session_01LjXwp6RG3FDtC4t3PqLCQs