Github user HyukjinKwon commented on a diff in the pull request:
https://github.com/apache/spark/pull/19872#discussion_r162047640
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/python/ExtractPythonUDFs.scala
---
@@ -39,18 +38,20 @@ object ExtractPythonUDFFromAggregate extends
Rule[LogicalPlan] {
*/
private def belongAggregate(e: Expression, agg: Aggregate): Boolean = {
e.isInstanceOf[AggregateExpression] ||
+ PythonUDF.isGroupAggPandasUDF(e) ||
agg.groupingExpressions.exists(_.semanticEquals(e))
}
private def hasPythonUdfOverAggregate(expr: Expression, agg: Aggregate):
Boolean = {
expr.find {
- e => e.isInstanceOf[PythonUDF] && e.find(belongAggregate(_,
agg)).isDefined
+ e => PythonUDF.isScalarPythonUDF(e) && e.find(belongAggregate(_,
agg)).isDefined
}.isDefined
}
private def extract(agg: Aggregate): LogicalPlan = {
val projList = new ArrayBuffer[NamedExpression]()
val aggExpr = new ArrayBuffer[NamedExpression]()
+
--- End diff --
ditto.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]