Github user holdenk commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16536#discussion_r97908047
  
    --- Diff: python/pyspark/sql/tests.py ---
    @@ -459,6 +459,23 @@ def filename(path):
             row2 = df2.select(sameText(df2['file'])).first()
             self.assertTrue(row2[0].find("people.json") != -1)
     
    +    def test_udf_defers_judf_initalization(self):
    +        from pyspark.sql.functions import UserDefinedFunction
    +
    +        f = UserDefinedFunction(lambda x: x, StringType())
    +
    +        self.assertIsNone(
    +            f._judf_placeholder,
    +            "judf should not be initialized before the first call."
    +        )
    +
    +        self.assertTrue(isinstance(f("foo"), Column), "UDF call should 
return a Column.")
    --- End diff --
    
    there is a `assertIsInstance` function that could simplify this.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to