ericm-db commented on code in PR #47104:
URL: https://github.com/apache/spark/pull/47104#discussion_r1670763037
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/TransformWithStateExec.scala:
##########
@@ -92,6 +93,35 @@ case class TransformWithStateExec(
}
}
+ /**
+ * We initialize this processor handle in the driver to run the init function
+ * and fetch the schemas of the state variables initialized in this
processor.
+ * @return a new instance of the driver processor handle
+ */
+ private def getDriverProcessorHandle: DriverStatefulProcessorHandleImpl = {
+ val driverProcessorHandle = new DriverStatefulProcessorHandleImpl(timeMode)
+ driverProcessorHandle.setHandleState(StatefulProcessorHandleState.PRE_INIT)
+ statefulProcessor.setHandle(driverProcessorHandle)
+ statefulProcessor.init(outputMode, timeMode)
+ driverProcessorHandle
+ }
+
+ /**
+ * Fetching the columnFamilySchemas from the StatefulProcessorHandle
+ * after init is called.
+ */
+ private def getColFamilySchemas(): Map[String, ColumnFamilySchema] = {
+ val driverProcessorHandle = getDriverProcessorHandle
+ val columnFamilySchemas = driverProcessorHandle.getColumnFamilySchemas
+ closeProcessorHandle()
+ columnFamilySchemas
+ }
+
+ private def closeProcessorHandle(): Unit = {
+ statefulProcessor.close()
Review Comment:
This instance won't ever be used again. Will comment.
--
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]