ErikBPF opened a new pull request, #7756:
URL: https://github.com/apache/datafusion-comet/pull/7756
## Which issue does this PR close?
Issue: #7672 (reference only; this draft does not request auto-closure).
## Rationale for this change
`checkAnswerWithTolerance` in `CometTestBase` skips a float/double
comparison whenever
either side is NaN, so a Comet NaN against a Spark number passes. Every
`query tolerance=...`
SQL fixture uses this comparison, which means such a fixture cannot catch a
kernel that
returns NaN where Spark returns a number.
## What changes are included in this PR?
- `CometTestBase.checkAnswerWithTolerance` compares NaN-ness explicitly: two
NaNs match, and
one-sided NaN fails with `actual answer <v> and correct answer <v> differ:
only one side is
NaN`. The infinity branch keeps precedence, and finite values keep the
existing
`abs(actual - expected) < absTol` check.
- The row-level overload becomes `protected` so the suite that consumes the
tolerance path can
assert the contract directly.
- Four regression tests in `CometSqlFileTestSuite` cover both-NaN, one-sided
NaN (Float and
Double, both directions), finite values inside/outside `absTol`, and
infinities.
No production code, SQL fixture, or assertion in existing suites is modified.
## How are these changes tested?
- RED (test-only commit): targeted tolerance tests -> `Tests: succeeded 3,
failed 1`; the
one-sided NaN test fails with "Expected exception ... TestFailedException
to be thrown, but
no exception was thrown".
- GREEN: same target -> `Tests: succeeded 4, failed 0`.
- `org.apache.comet.CometSqlFileTestSuite` (all fixtures, 108 `query
tolerance=` queries in
37 files): `Tests: succeeded 805, failed 0`.
- `org.apache.comet.CometMathExpressionSuite`: `Tests: succeeded 7, failed
0`.
Run in `nix-shell -p jdk17 maven cargo rustc protobuf cmake clang` with
`./mvnw test -Dtest=none -Dsuites="<suite>"`.
--
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]