[Bug] width_bucket returns NULL for an infinite value
维护者通常 1 天内回复
评估
调研方向
阅读crates/spark/src/function/math/width_bucket.rs,尤其是第254行附近的Float64内核,并追踪它如何处理有限值、无穷大和 NaN。将其行为与 issue 中 Spark 的行为进行比较,并运行 width_bucket 测试。完成标准是正无穷和负无穷分别返回num_bucket + 1和0,而 NaN 仍返回 NULL。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
width_bucket returns NULL when value is Infinity or -Infinity. Spark returns num_bucket + 1 for Infinity and 0 for -Infinity.
Spark's WidthBucket.computeBucketNumber returns null only for a NaN value, and for a NaN or infinite min or max. An infinite value is handled by the normal below-min and above-max checks. The Float64 kernel here nulls any value that is not finite, including value (width_bucket.rs#L254).
To Reproduce
SELECT width_bucket(CAST('Infinity' AS DOUBLE), CAST(0.0 AS DOUBLE), CAST(10.0 AS DOUBLE), CAST(5 AS BIGINT)),
width_bucket(CAST('-Infinity' AS DOUBLE), CAST(0.0 AS DOUBLE), CAST(10.0 AS DOUBLE), CAST(5 AS BIGINT));
datafusion-spark returns NULL NULL.
Expected behavior
As in Spark:
6 0
A NaN value should still return NULL, and it does in both.
Spark versions
Checked on PySpark 4.2.0 and 3.5.9, which give the same result.
datafusion-spark version
main at ab9d308
Additional context
Found while reviewing #414.
- 主要语言
- Rust
- 星标
- 13
- 派生
- 31
- 平均合并
- 2 天 2 小时
- 30 天内合并 PR
- 96
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
apache/datafusion-spark 的其他 Issue
-
难度 1/5 1-3 小时 新手友好度 84/100
apache/datafusion-spark#440 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
apache/datafusion-spark#439 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
apache/datafusion-spark#431 ·
维护者通常 1 天内回复
-
[Bug] format_string with %#e puts the decimal point after the exponent可能已有人在做 @vaidik787 于 5 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 80/100
apache/datafusion-spark#423 ·
维护者通常 1 天内回复
-
[Bug] parse_url ignores the key for a part other than QUERY, Spark returns NULL可能已有人在做 @Aryan2210 于 1 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 64/100
apache/datafusion-spark#409 · 2 条评论 ·
维护者通常 1 天内回复
查看 apache/datafusion-spark 的全部 Issue
相似的 Issue
-
autofix:working
难度 2/5 1-3 小时 新手友好度 82/100
-
难度 2/5 1-3 小时 新手友好度 75/100
libracoder/kiri#1138 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 83/100
roc-lang/basic-webserver#277 ·
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 82/100
samkerrcode/opengent#113 ·
维护者通常 1 天内回复
-
app bug session
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复