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/05/11 16:47:06 UTC

[GitHub] [spark] zhenlineo commented on a diff in pull request #41129: [SPARK-43133] Scala Client DataStreamWriter Foreach support

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


##########
connector/connect/server/src/main/scala/org/apache/spark/sql/connect/planner/SparkConnectPlanner.scala:
##########
@@ -2293,6 +2309,19 @@ class SparkConnectPlanner(val session: SparkSession) {
       writer.queryName(writeOp.getQueryName)
     }
 
+    if (writeOp.hasForeach) {
+      if (writeOp.getForeach.hasPythonWriter) {
+        val foreach = writeOp.getForeach.getPythonWriter
+        val pythonFcn = transformPythonForeachFunction(foreach)
+        writer.foreachPython(new PythonForeachWriter(pythonFcn, dataset.schema))
+      } else {
+        val scalaFcn = Utils.deserialize[ForeachWriter[Row]]( // TODO(wei): row? String?

Review Comment:
   Your code looks correct. Let me know if you have any other issues to run your tests.



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