Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

trunc(x) on a column turns -0.0 into 0.0

未关闭 适合新手
#25,702 1 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@1fanwang 已经在做这个了。

开始于 2026年9月25日。

  • #25732 来自 @1fanwang —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
75/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
rust, sql
领域
databases

调研方向

在 DataFusion 代码库中查找 trunc 函数的实现,可能在 expr/scalar.rs 或 expr/builtin.rs 等文件中。错误出现在使用 x == 0_f64 的列路径中。将该条件替换为保留符号的检查,或许可以直接使用 x.trunc()。在相应的测试模块中编写测试,以验证 trunc(-0.0) 对于列返回 -0.0。运行现有的 SQL 函数测试以确保没有回归。

由索引模型根据 Issue 内容生成。

描述

trunc(x) drops the sign of -0.0, but only when it runs on a column. On a scalar, and for trunc(x, 0), the sign is kept.

SELECT trunc(column1), trunc(column1, 0) FROM (VALUES (CAST(-0.0 AS DOUBLE)));
-- got:      0.0, -0.0
-- expected: -0.0, -0.0

The column code path returns 0.0 for either zero:

if x == 0_f64 { 0_f64 } else { x.trunc() }

-0.0 == 0.0 is true, so -0.0 becomes 0.0. f64::trunc already keeps the sign, so plain x.trunc() would be enough.

Seen through Lance (pylance 12.0.0): trunc(x, 0) on a -0.0 column returns -0.0. This line is the same on main and in 55.1.0. I found no existing issue or PR for it.

主要语言
Rust
星标
9.4k
派生
2.5k
平均合并
4 天 5 小时
30 天内合并 PR
331

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

apache/datafusion 的其他 Issue

查看 apache/datafusion 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。