ueshin commented on code in PR #41606:
URL: https://github.com/apache/spark/pull/41606#discussion_r1253731245
##########
python/pyspark/testing/utils.py:
##########
@@ -209,3 +234,79 @@ def check_error(
self.assertEqual(
expected, actual, f"Expected message parameters was '{expected}',
got '{actual}'"
)
+
+
+def assertDataFrameEqual(df: DataFrame, expected: DataFrame, ignore_row_order:
bool = True):
+ if df is None and expected is None:
+ return True
+ elif df is None or expected is None:
+ return False
+
+ def compare_rows(r1: Row, r2: Row):
+ def compare_vals(val1, val2):
+ if isinstance(val1, list) and isinstance(val2, list):
+ return all([compare_vals(x, y) for x, y in list(zip(val1,
val2))])
Review Comment:
nit: Shall we avoid surrounding with `[]` to leverage the short-circuit path?
```py
all(compare_vals(x, y) for x, y in zip(val1, val2))
```
also `list` is redundant.
--
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]