SQL file tests with a tolerance pass when only one side is NaN

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

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

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

调研方向

先阅读 CometTestBase.scala,并找到 checkSparkAnswerWithTolerance。它会比较使用 query tolerance=... 的 SQL 文件测试中的 float 和 double 结果。更新 NaN 比较逻辑,使一对值仅在两者都是 NaN,或两者都是容差范围内的数字时才匹配。通过一个覆盖单侧 NaN 的回归用例和一个两侧均为 NaN 的匹配用例进行验证。

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

描述

requires-triage
Describe the bug

checkSparkAnswerWithTolerance in CometTestBase.scala skips the comparison of a float or double pair whenever either side is NaN. It only compares values when !actual.isNaN && !expected.isNaN, so a NaN from Comet against a number from Spark, or the other way round, passes. A SQL file test with query tolerance=... uses this check, so it cannot catch a kernel that returns NaN where Spark does not.

Steps to reproduce

A query tolerance=1e-6 over ln(x) where Comet returns NaN on some rows and Spark returns a value passes. The plain query form of the same test fails with "Results do not match".

Expected behavior

The pair should match only when both sides are NaN, or both are numbers within the tolerance: if (actual.isNaN || expected.isNaN) assert(actual.isNaN && expected.isNaN).

Additional context

Found while reproducing the wrong ln results in #7671.

主要语言
Scala
星标
1.3k
派生
418
平均合并
3 天 18 小时
30 天内合并 PR
155

环境准备

从这里开始

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

apache/datafusion-comet 的其他 Issue

查看 apache/datafusion-comet 的全部 Issue

相似的 Issue

更多 Scala Issue

把新 issue 发到你的邮箱

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