This is an automated email from the ASF dual-hosted git repository. gurwls223 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push: new aa4a84bd8474 [SPARK-47933][PYTHON][CONNECT][FOLLOW-UP] Add a check of `__name__` at `_with_origin` aa4a84bd8474 is described below commit aa4a84bd8474e697e3e3d7fa9135b09f1de27f2f Author: Hyukjin Kwon <gurwls...@apache.org> AuthorDate: Wed Apr 24 11:49:12 2024 +0900 [SPARK-47933][PYTHON][CONNECT][FOLLOW-UP] Add a check of `__name__` at `_with_origin` ### What changes were proposed in this pull request? This PR is a followup of https://github.com/apache/spark/pull/46155 that adds check of `__name__` at `_with_origin`. ### Why are the changes needed? It is possible for a callable instance without __name__ attribute or/and __module__ attribute to be wrapped. For example, functools.partial. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? `./bin/pyspark` ### Was this patch authored or co-authored using generative AI tooling? No. Closes #46198 from HyukjinKwon/SPARK-47933-followup2. Authored-by: Hyukjin Kwon <gurwls...@apache.org> Signed-off-by: Hyukjin Kwon <gurwls...@apache.org> --- python/pyspark/errors/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/pyspark/errors/utils.py b/python/pyspark/errors/utils.py index 16fba7e272bc..08744dc4c264 100644 --- a/python/pyspark/errors/utils.py +++ b/python/pyspark/errors/utils.py @@ -174,7 +174,7 @@ def _with_origin(func: Callable[..., Any]) -> Callable[..., Any]: from pyspark.sql import SparkSession spark = SparkSession.getActiveSession() - if spark is not None: + if spark is not None and hasattr(func, "__name__"): assert spark._jvm is not None pyspark_origin = spark._jvm.org.apache.spark.sql.catalyst.trees.PySparkCurrentOrigin --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org