zero323 commented on code in PR #37748:
URL: https://github.com/apache/spark/pull/37748#discussion_r961479775


##########
python/pyspark/sql/tests/test_functions.py:
##########
@@ -1029,6 +1034,11 @@ def test_np_scalar_input(self):
             res = df.select(array_position(df.data, 
dtype(1)).alias("c")).collect()
             self.assertEqual([Row(c=1), Row(c=0)], res)
 
+    def test_binary_math_function(self):
+        for func, res in [(atan2, 0.13664), (hypot, 8.07527), (pow, 2.14359), 
(pmod, 1.1)]:
+            df = self.spark.range(1).select(round(func(1.1, 8), 5).alias("a"))
+            self.assertEqual(Row(a=res), df.first())

Review Comment:
   Nit. We could skip multiple actions here, doing something around these lines 
(not tested, there might be some typos there):
   
   
   ```python
   funcs, expected = zip(*[(atan2, 0.13664), (hypot, 8.07527), (pow, 2.14359), 
(pmod, 1.1)])
   df = spark.range(1).select(*(func(1.1, 8) for func in funcs)
   
   for a, e in zip(df.first(), expected):
       self.assertAlmostEqual(a, e, 5)
   ```
   
   



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

Reply via email to