jingz-db commented on code in PR #49560:
URL: https://github.com/apache/spark/pull/49560#discussion_r1963030272
##########
sql/connect/server/src/main/scala/org/apache/spark/sql/connect/planner/SparkConnectPlanner.scala:
##########
@@ -1034,6 +1038,49 @@ class SparkConnectPlanner(
.logicalPlan
}
+ private def transformTransformWithStateInPandas(
+ pythonUdf: PythonUDF,
+ groupedDs: RelationalGroupedDataset,
+ rel: proto.GroupMap): LogicalPlan = {
+ val twsInfo = rel.getTransformWithStateInfo
+ val outputSchema = parseSchema(twsInfo.getOutputSchema)
+
+ if (rel.hasInitialInput) {
+ val initialGroupingCols =
rel.getInitialGroupingExpressionsList.asScala.toSeq.map(expr =>
+ Column(transformExpression(expr)))
+
+ val initialStateDs = Dataset
+ .ofRows(session, transformRelation(rel.getInitialInput))
Review Comment:
Is there any recommended way for restoring RelationalGroupedDataset in the
connect world? I saw `Dataset.ofRows()` is used in multiple places in
`SparkConnectPlanner.scala`. e.g. coGroupMap is doing the above as well to
restoring a RelationalGroupedDataset as well:
https://github.com/apache/spark/blob/master/sql/connect/server/src/main/scala/org/apache/spark/sql/connect/planner/SparkConnectPlanner.scala#L791
Essentially we are doing the same thing for `initialStateDs` here - it is a
user input parameter of type RelationalGroupedDataset.
--
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]