Github user ueshin commented on a diff in the pull request:
https://github.com/apache/spark/pull/20360#discussion_r163189081
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/python/ExtractPythonUDFs.scala
---
@@ -45,7 +45,8 @@ object ExtractPythonUDFFromAggregate extends
Rule[LogicalPlan] {
private def hasPythonUdfOverAggregate(expr: Expression, agg: Aggregate):
Boolean = {
expr.find {
- e => PythonUDF.isScalarPythonUDF(e) && e.find(belongAggregate(_,
agg)).isDefined
+ e => PythonUDF.isScalarPythonUDF(e) &&
+ (e.references.isEmpty || e.find(belongAggregate(_, agg)).isDefined)
--- End diff --
Can we use just `e.children` instead of `e.references`?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]