You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "zhenlineo (via GitHub)" <gi...@apache.org> on 2023/06/13 16:12:17 UTC

[GitHub] [spark] zhenlineo commented on a diff in pull request #41501: [SPARK-43415][Connect] Add mapValues for KeyValueGroupedDS#agg

zhenlineo commented on code in PR #41501:
URL: https://github.com/apache/spark/pull/41501#discussion_r1228387133


##########
connector/connect/server/src/main/scala/org/apache/spark/sql/connect/planner/SparkConnectPlanner.scala:
##########
@@ -1194,6 +1190,18 @@ class SparkConnectPlanner(val session: SparkSession) extends Logging {
 
     val projection = rel.getExpressionsList.asScala.toSeq
       .map(transformExpression)
+      .map { expr =>
+        expr transform {
+          case f: ScalaUDF if hasUnresolvedStartAsInput(f) =>
+            if (f.children.size == 1 && baseRel.output.size > 1) {
+              // The udf take the whole row as the single function input
+              f.withNewChildrenInternal(IndexedSeq(CastScalaUDFInputExpression(baseRel.output)))
+            } else {
+              f.withNewChildrenInternal(baseRel.output.toIndexedSeq)
+            }

Review Comment:
   Any better solutions than using this?



-- 
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-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org