jingz-db commented on code in PR #49156:
URL: https://github.com/apache/spark/pull/49156#discussion_r1887724687
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/python/TransformWithStateInPandasPythonRunner.scala:
##########
@@ -238,7 +224,130 @@ abstract class
TransformWithStateInPandasPythonBaseRunner[I](
super.compute(inputIterator, partitionIndex, context)
}
- private def closeServerSocketChannelSilently(stateServerSocket:
ServerSocket): Unit = {
+ override protected def writeUDF(dataOut: DataOutputStream): Unit = {
+ PythonUDFRunner.writeUDFs(dataOut, funcs, argOffsets, None)
+ }
+}
+
+class TransformWithStateInPandasPythonPreInitRunner(
+ func: PythonFunction,
+ workerModule: String,
+ timeZoneId: String,
+ groupingKeySchema: StructType,
+ processorHandleImpl: DriverStatefulProcessorHandleImpl)
+ extends StreamingPythonRunner(func, "", "", workerModule)
+ with TransformWithStateInPandasPythonRunnerUtils
+ with Logging {
+ protected val sqlConf = SQLConf.get
+
+ private var dataIn: DataInputStream = _
+ private var dataOut: DataOutputStream = _
+
+ private var daemonThread: Thread = _
+
+ override def init(): (DataOutputStream, DataInputStream) = {
+ val env = SparkEnv.get
+
+ val localdir = env.blockManager.diskBlockManager.localDirs.map(f =>
f.getPath()).mkString(",")
Review Comment:
I am not one hundred percent sure but this is exactly same as what the base
`StreamingPythonRunner` class is doing here:
https://github.com/apache/spark/blob/master/core/src/main/scala/org/apache/spark/api/python/StreamingPythonRunner.scala#L66
and also the same as custom python source here:
https://github.com/apache/spark/blob/master/sql/core/src/main/scala/org/apache/spark/sql/execution/python/PythonStreamingSourceRunner.scala#L89
--
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]