cloud-fan commented on code in PR #41142:
URL: https://github.com/apache/spark/pull/41142#discussion_r1193816925
##########
python/pyspark/sql/udf.py:
##########
@@ -439,13 +439,23 @@ def func(*args: Any, **kwargs: Any) -> Any:
func.__signature__ = inspect.signature(f) # type:
ignore[attr-defined]
judf = self._create_judf(func)
jPythonUDF = judf.apply(_to_seq(sc, cols, _to_java_column))
- id = jPythonUDF.expr().resultId().id()
+ id = self._get_udf_id(jPythonUDF.expr())
sc.profiler_collector.add_profiler(id, memory_profiler)
else:
judf = self._judf
jPythonUDF = judf.apply(_to_seq(sc, cols, _to_java_column))
return Column(jPythonUDF)
+ def _get_udf_id(self, jexpr: JavaObject) -> int:
+ if is_instance_of(
+ sc._gateway,
+ jexpr,
+
"org.apache.spark.sql.catalyst.expressions.aggregate.AggregateExpression",
+ ):
+ return jexpr.child().resultId().id() # PythonUDAF
+ else
Review Comment:
```suggestion
else:
```
--
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]