anishshri-db commented on code in PR #49560:
URL: https://github.com/apache/spark/pull/49560#discussion_r1943581472


##########
python/pyspark/sql/connect/group.py:
##########
@@ -361,6 +362,63 @@ def applyInPandasWithState(
 
     applyInPandasWithState.__doc__ = 
PySparkGroupedData.applyInPandasWithState.__doc__
 
+    def transformWithStateInPandas(
+        self,
+        statefulProcessor: StatefulProcessor,
+        outputStructType: Union[StructType, str],
+        outputMode: str,
+        timeMode: str,
+        initialState: Optional["GroupedData"] = None,
+        eventTimeColumnName: str = "",
+    ) -> "DataFrame":
+        from pyspark.sql.connect.udf import UserDefinedFunction
+        from pyspark.sql.connect.dataframe import DataFrame
+        from pyspark.sql.streaming.stateful_processor_util import 
TransformWithStateInPandasUdfUtils
+
+        udf_util = TransformWithStateInPandasUdfUtils(statefulProcessor, 
timeMode)
+        if initialState is None:
+            udf_obj = UserDefinedFunction(
+                udf_util.transformWithStateUDF,
+                returnType=outputStructType,
+                evalType=PythonEvalType.SQL_TRANSFORM_WITH_STATE_PANDAS_UDF,
+            )
+            initial_state_plan = None
+            initial_state_grouping_cols = None
+

Review Comment:
   nit: do we need newline here ?



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