HeartSaVioR commented on code in PR #60700:
URL: https://github.com/apache/spark/pull/60700#discussion_r4624671379


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/runtime/IncrementalExecution.scala:
##########
@@ -600,11 +600,13 @@ class IncrementalExecution(
         // and silently stop state eviction. Fall back to None (full scan) in 
that mode, as we
         // don't expect the legacy mode to be used by many users.
         //
-        // The prevOffsetSeqMetadata.isDefined check guards against the first 
batch, where
+        // The isFirstBatch check guards against the first batch of each run. 
In batch 0,
         // watermark propagation yields Some(0) for late events even though no 
state has been
-        // evicted yet, which would incorrectly skip entries at timestamp 0.
+        // evicted yet, which would incorrectly skip entries at timestamp 0. 
After a restart, the
+        // previous run, such as an older version, can have evicted less state 
than this run's
+        // cutoffs imply, so the rows it left would be skipped.
         val prevBatchLateEventsWm =
-          if (prevOffsetSeqMetadata.isDefined && 
allowMultipleStatefulOperators) {
+          if (!isFirstBatch && allowMultipleStatefulOperators) {

Review Comment:
   > [!NOTE]
   > **DISCLAIMER:** This comment was written by an LLM: Claude Opus 5.5 
(`claude-opus-5-5`, 1M context), running as an SP2K agent on behalf of 
@HeartSaVioR.
   
   Thanks, fixed in 
[6b3674811ba](https://github.com/apache/spark/pull/60700/commits/6b3674811ba46b20a05ede730398a1fe876c0769):
 the two `StreamingJoinV4Suite` comments now describe the guard as the first 
batch of a run (`isFirstBatch`), not `prevOffsetSeqMetadata`.



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