Github user zero323 commented on a diff in the pull request: https://github.com/apache/spark/pull/16536#discussion_r97951062 --- Diff: python/pyspark/sql/functions.py --- @@ -1826,19 +1826,27 @@ class UserDefinedFunction(object): def __init__(self, func, returnType, name=None): self.func = func self.returnType = returnType - self._judf = self._create_judf(name) - - def _create_judf(self, name): + self._judf_placeholder = None + self._name = name or ( + func.__name__ if hasattr(func, '__name__') + else func.__class__.__name__) + + @property + def _judf(self): + if self._judf_placeholder is None: --- End diff -- Could you elaborate a bit? I am not sure if I understand the issue. Assignment is atomic (so we don't have to worry about corruption), for any practical purpose operation is idempotent (we can return expressions using different Java objects but as far as I am concerned this is just a detail of implementation), access to Py4J is thread safe and as far as I remember function registries are synchronized. I there any issue i missed here? Thanks for looking into 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