comphead commented on code in PR #7756:
URL: https://github.com/apache/datafusion-comet/pull/7756#discussion_r4762660526


##########
spark/src/test/scala/org/apache/comet/CometSqlFileTestSuite.scala:
##########
@@ -242,6 +242,60 @@ class CometSqlFileTestSuite extends CometTestBase with 
AdaptiveSparkPlanHelper {
     }
   }
 
+  // `query tolerance=...` fixtures route through `checkAnswerWithTolerance`, 
which must treat
+  // NaN the way Spark does: two NaNs match, and a NaN against a number does 
not. See #7672.
+  test("tolerance comparison: both sides NaN") {
+    Seq(Row(Float.NaN) -> Row(Float.NaN), Row(Double.NaN) -> 
Row(Double.NaN)).foreach {
+      case (actual, expected) =>
+        checkAnswerWithTolerance(actual, expected, 1e-6)
+    }
+  }
+
+  test("tolerance comparison: one-sided NaN") {

Review Comment:
   The one-sided cases only use finite numbers. Two other routes into the NaN 
logic are untested. `Row(null)` against `Row(Double.NaN)` goes through the 
final `actual == expected` arm, and `Row(Double.PositiveInfinity)` against 
`Row(Double.NaN)` goes through the infinity branch, whose message does not say 
`only one side is NaN`. Adding both pairs to this test (in both directions) 
pins the behavior for a null Spark result against a NaN Comet result, which is 
the likely shape of a real kernel bug.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to