fedimser commented on code in PR #53159:
URL: https://github.com/apache/spark/pull/53159#discussion_r2662492359


##########
sql/core/src/main/scala/org/apache/spark/sql/streaming/TwsTester.scala:
##########
@@ -0,0 +1,286 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.spark.sql.streaming
+
+import java.sql.Timestamp
+import java.time.{Clock, Instant, ZoneId}
+
+import scala.reflect.ClassTag
+
+import 
org.apache.spark.sql.execution.streaming.operators.stateful.transformwithstate.statefulprocessor.ImplicitGroupingKeyTracker
+import 
org.apache.spark.sql.execution.streaming.operators.stateful.transformwithstate.testing.InMemoryStatefulProcessorHandle
+import 
org.apache.spark.sql.execution.streaming.operators.stateful.transformwithstate.timers.{ExpiredTimerInfoImpl,
 TimerValuesImpl}
+
+/**
+ * Testing utility for transformWithState stateful processors.
+ *
+ * This class enables unit testing of StatefulProcessor business logic by 
simulating the
+ * behavior of transformWithState. It processes input rows and returns output 
rows equivalent
+ * to those that would be produced by the processor in an actual Spark 
streaming query.
+ *
+ * '''Supported:'''
+ *  - Processing input rows and producing output rows via `test()`.
+ *  - Initial state setup via constructor parameter.
+ *  - Direct state manipulation via `setValueState`, `setListState`, 
`setMapState`.
+ *  - Direct state inspection via `peekValueState`, `peekListState`, 
`peekMapState`.
+ *  - Timers in ProcessingTime mode (use `advanceProcessingTime` to fire 
timers).
+ *  - Timers in EventTime mode (use `eventTimeExtractor` and 
`watermarkDelayMs` to configure;
+ *    watermark advances automatically based on event times, or use 
`advanceWatermark` manually).
+ *  - Late event filtering in EventTime mode (events older than the current 
watermark are dropped).

Review Comment:
   The Scala doc for TwsTester class makes this clear. It says "Testing utility 
for transformWithState stateful processors." and then "This class enables unit 
testing of StatefulProcessor business logic".
   
   I do not understand intention of this code review comment. Is it to make 
some changes to documentation or to remove support for late event filtering?



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