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

[GitHub] [spark] ueshin commented on a diff in pull request #40203: [SPARK-42612][CONNECT][PYTHON][TEST] Enable more parity tests related to functions

ueshin commented on code in PR #40203:
URL: https://github.com/apache/spark/pull/40203#discussion_r1119468331


##########
python/pyspark/sql/tests/test_functions.py:
##########
@@ -318,19 +318,29 @@ def test_math_functions(self):
         )
 
     def test_inverse_trig_functions(self):
-        from pyspark.sql import functions
+        df = self.spark.createDataFrame([Row(a=i * 0.2, b=i * -0.2) for i in range(10)])
 
-        funs = [
-            (functions.acosh, "ACOSH"),
-            (functions.asinh, "ASINH"),
-            (functions.atanh, "ATANH"),
-        ]
+        def check(trig, inv, y_axis_symmetrical):
+            SQLTestUtils.assert_close(
+                [n * 0.2 for n in range(10)],
+                df.select(inv(trig(df.a))).collect(),
+            )
+            if y_axis_symmetrical:
+                SQLTestUtils.assert_close(
+                    [n * 0.2 for n in range(10)],
+                    df.select(inv(trig(df.b))).collect(),
+                )
+            else:
+                SQLTestUtils.assert_close(
+                    [n * -0.2 for n in range(10)],
+                    df.select(inv(trig(df.b))).collect(),
+                )
 
-        cols = ["a", functions.col("a")]
+        from pyspark.sql import functions
 
-        for f, alias in funs:
-            for c in cols:
-                self.assertIn(f"{alias}(a)", repr(f(c)))

Review Comment:
   The upper case name needs to communicate with server side. Do we still want to match this?



-- 
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