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


##########
sql/core/src/main/scala/org/apache/spark/sql/KeyValueGroupedDataset.scala:
##########
@@ -676,6 +678,43 @@ class KeyValueGroupedDataset[K, V] private[sql](
     )
   }
 
+  private[sql] def transformWithState[U: Encoder](
+       statefulProcessor: StatefulProcessor[K, V, U],
+       timeoutMode: TimeoutMode,
+       eventTimeColumnName: String,
+       outputMode: OutputMode): Dataset[U] = {
+    val existingWatermarkDelay = logicalPlan.flatMap {
+      case EventTimeWatermark(_, delay, _) => Seq(delay)
+      case _ => Seq()
+    }
+
+    if (existingWatermarkDelay.isEmpty) {
+      throw QueryCompilationErrors.cannotAssignEventTimeColumn()
+    }
+
+    val transformWithState = TransformWithState[K, V, U](
+      groupingAttributes,
+      dataAttributes,
+      statefulProcessor,
+      timeoutMode,
+      outputMode,
+      child = logicalPlan
+    )
+
+    val twsDS = Dataset[U](
+      sparkSession,
+      transformWithState
+    )
+
+    val delay = existingWatermarkDelay.head
+
+    Dataset[U](sparkSession, EliminateEventTimeWatermark(
+      UpdateEventTimeWatermarkColumn(
+        UnresolvedAttribute(eventTimeColumnName),

Review Comment:
   How do we check that this output attribute name is indeed part of the output 
generated by `TransformWithState` ?



-- 
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-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to