Github user ueshin commented on a diff in the pull request: https://github.com/apache/spark/pull/19872#discussion_r157939292 --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/python/ExtractPythonUDFs.scala --- @@ -48,29 +48,46 @@ object ExtractPythonUDFFromAggregate extends Rule[LogicalPlan] { }.isDefined } + private def isPandasGroupAggUdf(expr: Expression): Boolean = expr match { + case PythonUDF(_, _, _, _, PythonEvalType.SQL_PANDAS_GROUP_AGG_UDF) => true + case Alias(child, _) => isPandasGroupAggUdf(child) + case _ => false + } + + private def hasPandasGroupAggUdf(agg: Aggregate): Boolean = { + val actualAggExpr = agg.aggregateExpressions.drop(agg.groupingExpressions.length) --- End diff -- Do we need to drop the grouping expressions? If we need, we can drop them only if `conf.dataFrameRetainGroupColumns == true`, otherwise `aggregateExpressions` doesn't contain `groupingExpressions`?
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org