HyukjinKwon commented on PR #58790: URL: https://github.com/apache/spark/pull/58790#issuecomment-5672891793
<!-- ai-code-review --> **Review — [PYTHON] Handle nonfinite values in assertDataFrameEqual** LGTM. The fix in `compare_vals` is correct. Previously the float branch only did `abs(val1 - val2) > (atol + rtol * abs(val2))`; since `abs(nan - x)` is `nan` and `nan > y` is `False`, a `NaN` silently compared **equal** to any finite value. The new guards make `NaN` equal only to `NaN`, and `inf`/`-inf` compare by exact equality. The early `return`s don't skip any tail logic — the finite path's only other exit is `return False`, otherwise it falls through to the same trailing `return True`. Because both list and DataFrame inputs flow through `compare_vals`, the fix covers both. I exercised the behavior directly (list inputs need no JVM): `NaN` vs finite/`inf` → unequal; `NaN`/`inf`/`-inf` vs themselves → equal; `rtol` tolerance and nested `Row`/list/map cases all behave as asserted. The tests are well chosen — both argument orders, `checkRowOrder`, tolerance settings, and nested structures — and `NonFiniteComparisonTests(unittest.TestCase)` is the right minimal base since the list inputs require no `SparkSession`. Optional nit: the title has no `[SPARK-xxxxx]` id. For a behavior bug fix Spark usually wants a JIRA ticket unless it is intentionally kept trivial/minor. -- 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]
