peter-toth commented on code in PR #42864: URL: https://github.com/apache/spark/pull/42864#discussion_r1328960631
########## sql/core/src/main/scala/org/apache/spark/sql/RelationalGroupedDataset.scala: ########## @@ -708,7 +708,7 @@ private[sql] object RelationalGroupedDataset { case expr: NamedExpression => expr case a: AggregateExpression if a.aggregateFunction.isInstanceOf[TypedAggregateExpression] => UnresolvedAlias(a, Some(Column.generateAlias)) - case u: UnresolvedFunction => UnresolvedAlias(expr, None) + case e if !e.resolved => UnresolvedAlias(expr, None) Review Comment: Without this change some Python tests fail like `sum_udf(col("v2")) + 5` here: https://github.com/apache/spark/blob/master/python/pyspark/sql/tests/pandas/test_pandas_udf_grouped_agg.py#L404C17-L404C40. I debugged this today and it seems these are `AggregateExpression`s but the aggregate function is `PythonUDAF` so they don't match the previous `case a: AggregateExpression if a.aggregateFunction.isInstanceOf[TypedAggregateExpression] =>` case. Shall we remove the if condition? `Column.generateAlias` seems to take care of it: https://github.com/apache/spark/blob/master/sql/core/src/main/scala/org/apache/spark/sql/Column.scala#L44-L50 -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org