amaliujia commented on code in PR #40070:
URL: https://github.com/apache/spark/pull/40070#discussion_r1110378209


##########
connector/connect/client/jvm/src/main/scala/org/apache/spark/sql/RelationalGroupedDataset.scala:
##########
@@ -109,44 +109,131 @@ class RelationalGroupedDataset protected[sql] (
     agg(exprs.asScala.toMap)
   }
 
-  private[this] def strToExpr(expr: String, inputExpr: proto.Expression): 
proto.Expression = {
+  private[this] def strToExpr(expr: String, columnName: String): 
proto.Expression = {
     val builder = proto.Expression.newBuilder()
 
     expr.toLowerCase(Locale.ROOT) match {
       // We special handle a few cases that have alias that are not in 
function registry.
       case "avg" | "average" | "mean" =>
-        builder.getUnresolvedFunctionBuilder
-          .setFunctionName("avg")
-          .addArguments(inputExpr)
-          .setIsDistinct(false)
+        functions.avg(columnName)

Review Comment:
   I think I did right replacement and hit a proto -> plan test generation 
failure. 
   
   I am planing look into that separately. I am gonna need some time to learn 
how to debug `org.apache.spark.sql.connect.ProtoToParsedPlanTestSuite` 



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to