You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "HyukjinKwon (via GitHub)" <gi...@apache.org> on 2023/07/06 06:38:06 UTC

[GitHub] [spark] HyukjinKwon commented on a diff in pull request #41606: [SPARK-44061][PYTHON] Add assertDataFrameEqual util function

HyukjinKwon commented on code in PR #41606:
URL: https://github.com/apache/spark/pull/41606#discussion_r1253996096


##########
python/docs/source/reference/pyspark.testing.rst:
##########
@@ -0,0 +1,28 @@
+..  Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+..    http://www.apache.org/licenses/LICENSE-2.0
+
+..  Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+
+===

Review Comment:
   ```suggestion
   =======
   ```



##########
python/docs/source/reference/pyspark.testing.rst:
##########
@@ -0,0 +1,28 @@
+..  Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+..    http://www.apache.org/licenses/LICENSE-2.0
+
+..  Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+
+===
+Testing
+===

Review Comment:
   Should be same. Otherwise, Sphinx complains.



##########
python/docs/source/reference/pyspark.testing.rst:
##########
@@ -0,0 +1,28 @@
+..  Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+..    http://www.apache.org/licenses/LICENSE-2.0
+
+..  Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+
+===
+Testing
+===

Review Comment:
   ```suggestion
   =======
   ```



##########
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).

Review Comment:
   If we're exposing this as an API, it should have documentation that follows NumPy documentations. Let's probably at least have [Parameters](https://numpydoc.readthedocs.io/en/latest/format.html#parameters).



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org