hvanhovell commented on code in PR #49111: URL: https://github.com/apache/spark/pull/49111#discussion_r1940423815
########## connector/connect/client/jvm/src/main/scala/org/apache/spark/sql/KeyValueGroupedDataset.scala: ########## @@ -588,16 +681,24 @@ private object KeyValueGroupedDatasetImpl { val dummyGroupingFunc = SparkUserDefinedFunction( function = UdfUtils.noOp[V, K](), inputEncoders = vEncoder :: Nil, - outputEncoder = kEncoder).apply(col("*")) + outputEncoder = kEncoder).withName(DUMMY_UDF_NAME).apply(col("*")) val session = df.sparkSession new KeyValueGroupedDatasetImpl( session, df.plan, kEncoder, vEncoder, vEncoder, - (Seq(dummyGroupingFunc) ++ groupingExprs).map(toExpr).asJava, + Seq(dummyGroupingFunc) ++ groupingExprs, None, () => df.select(groupingExprs: _*).as(kEncoder)) } + + val DUMMY_UDF_NAME = "__spark__connect__internal__dummy__" Review Comment: You can also check the instance. There is nothing mutable in the current UDF, so we might as well reuse it. -- 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