dongjoon-hyun commented on a change in pull request #25352:
[SPARK-28422][SQL][Python] GROUPED_AGG pandas_udf should work without group by
clause
URL: https://github.com/apache/spark/pull/25352#discussion_r310445192
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
##########
@@ -1780,15 +1780,17 @@ class Analyzer(
def containsAggregates(exprs: Seq[Expression]): Boolean = {
// Collect all Windowed Aggregate Expressions.
- val windowedAggExprs = exprs.flatMap { expr =>
+ val windowedAggExprs: Set[Expression] = exprs.flatMap { expr =>
expr.collect {
case WindowExpression(ae: AggregateExpression, _) => ae
+ case WindowExpression(e: PythonUDF, _) if
PythonUDF.isGroupedAggPandasUDF(e) => e
}
}.toSet
// Find the first Aggregate Expression that is not Windowed.
exprs.exists(_.collectFirst {
case ae: AggregateExpression if !windowedAggExprs.contains(ae) => ae
+ case e if PythonUDF.isGroupedAggPandasUDF(e) &&
!windowedAggExprs.contains(e) => e
Review comment:
Although we need to break the line, we had better use `e: PythonUDF` instead
of `e` in the `case` statement.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]