hvanhovell commented on code in PR #41704:
URL: https://github.com/apache/spark/pull/41704#discussion_r1244536573


##########
connector/connect/server/src/main/scala/org/apache/spark/sql/connect/planner/SparkConnectPlanner.scala:
##########
@@ -2612,15 +2637,10 @@ class SparkConnectPlanner(val sessionHolder: 
SessionHolder) extends Logging {
       } else {
         val foreachWriterPkt = 
unpackForeachWriter(writeOp.getForeachWriter.getScalaWriter)
         val clientWriter = foreachWriterPkt.foreachWriter
-        if (foreachWriterPkt.datasetEncoder == null) {
-          // datasetEncoder is null means the client-side writer has type 
parameter Row,
-          // Since server-side dataset is always dataframe, here just use 
foreach directly.
-          writer.foreach(clientWriter.asInstanceOf[ForeachWriter[Row]])
-        } else {
-          val encoder = ExpressionEncoder(
-            foreachWriterPkt.datasetEncoder.asInstanceOf[AgnosticEncoder[Any]])
-          
writer.foreachImplementation(clientWriter.asInstanceOf[ForeachWriter[Any]], 
encoder)
-        }
+        val encoder: Option[ExpressionEncoder[Any]] = Try(

Review Comment:
   NVM I got it. It is a bit too clever for my liking. I spend a few moments 
trying to figure out where are resolving the row encoder.



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