ueshin opened a new pull request, #49449:
URL: https://github.com/apache/spark/pull/49449

   ### What changes were proposed in this pull request?
   
   Fixes `SparkConnectPlanner` to analyze the inputs for typed aggregations.
   
   ### Why are the changes needed?
   
   The inputs for typed aggregations should be analyzed.
   
   For example:
   
   ```scala
   val ds = Seq("abc", "xyz", "hello").toDS().select("*").as[String]
   ds.groupByKey(_.length).reduceGroups(_ + _).show()
   ```
   
   fails with:
   
   ```
   org.apache.spark.SparkException: [INTERNAL_ERROR] Invalid call to 
toAttribute on unresolved object SQLSTATE: XX000
     
org.apache.spark.sql.catalyst.analysis.Star.toAttribute(unresolved.scala:439)
     
org.apache.spark.sql.catalyst.plans.logical.Project.$anonfun$output$1(basicLogicalOperators.scala:74)
     scala.collection.immutable.List.map(List.scala:247)
     scala.collection.immutable.List.map(List.scala:79)
     
org.apache.spark.sql.catalyst.plans.logical.Project.output(basicLogicalOperators.scala:74)
     
org.apache.spark.sql.connect.planner.SparkConnectPlanner.transformExpressionWithTypedReduceExpression(SparkConnectPlanner.scala:2340)
     
org.apache.spark.sql.connect.planner.SparkConnectPlanner.$anonfun$transformKeyValueGroupedAggregate$1(SparkConnectPlanner.scala:2244)
     scala.collection.immutable.List.map(List.scala:247)
     scala.collection.immutable.List.map(List.scala:79)
     
org.apache.spark.sql.connect.planner.SparkConnectPlanner.transformKeyValueGroupedAggregate(SparkConnectPlanner.scala:2244)
     
org.apache.spark.sql.connect.planner.SparkConnectPlanner.transformAggregate(SparkConnectPlanner.scala:2232)
   ...
   ```
   
   ### Does this PR introduce _any_ user-facing change?
   
   The failure will not appear.
   
   ### How was this patch tested?
   
   Added the related tests.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   No.
   


-- 
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

Reply via email to