Github user zero323 commented on a diff in the pull request:
https://github.com/apache/spark/pull/16535#discussion_r95576650
--- Diff: python/pyspark/sql/tests.py ---
@@ -429,6 +429,11 @@ def test_udf_with_input_file_name(self):
row =
self.spark.read.json(filePath).select(sourceFile(input_file_name())).first()
self.assertTrue(row[0].find("people1.json") != -1)
+ def test_udf_shouldnt_accept_noncallable_object(self):
+ from pyspark.sql.functions import udf
+
+ self.assertRaises(TypeError, udf)
--- End diff --
Different positive scenarios are quite well covered by the [existing
tests](https://github.com/apache/spark/blob/master/python/pyspark/sql/tests.py#L271-L310).
`self.assertRaises` actually calls its argument when it is executed. But we
should really test `UserDefinedFunction` directly here, not `udf`. Let me
correct that.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]