asl3 commented on code in PR #41606:
URL: https://github.com/apache/spark/pull/41606#discussion_r1254628646
##########
python/pyspark/testing/utils.py:
##########
@@ -209,3 +232,105 @@ def check_error(
self.assertEqual(
expected, actual, f"Expected message parameters was '{expected}',
got '{actual}'"
)
+
+
+def assertDataFrameEqual(
+ df: DataFrame, expected: Union[DataFrame, List[Row]], ignore_row_order:
bool = True
+):
+ """
+ A util function to assert equality between DataFrames `df` and `expected`,
with
+ optional arg `ignore_row_order`.
+ For float values, assert approximate equality (1e-5 by default).
+ """
+ if df is None and expected is None:
+ return True
+ elif df is None or expected is None:
+ return False
+
+ if not isinstance(df, DataFrame):
+ raise PySparkAssertionError(
+ error_class="UNSUPPORTED_DATA_TYPE",
+ message_parameters={"data_type": type(df)},
+ )
+ elif not isinstance(expected, DataFrame):
+ raise PySparkAssertionError(
+ error_class="UNSUPPORTED_DATA_TYPE",
+ message_parameters={"data_type": type(expected)},
+ )
+
+ def compare_rows(r1: Row, r2: Row):
Review Comment:
thank you, added tests for these!
--
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]