spark-test commented on code in PR #60283:
URL: https://github.com/apache/spark/pull/60283#discussion_r4530592058


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/StreamingJoinHelper.scala:
##########
@@ -186,6 +297,14 @@ object StreamingJoinHelper extends PredicateHelper with 
Logging {
       return None
     }
 
+    // State eviction compares this cutoff in timestamp units against the 
constrained column.
+    val hasTimestampStateAttribute = constraintTerm.exists {
+      case a: AttributeReference =>
+        attributesToFindStateWatermarkFor.contains(a) && a.dataType == 
TimestampType

Review Comment:
   Agreed that master's window-end eviction drops matches when the stored 
windows are shorter than the other input's, and that window columns do not 
record their durations today. But this change also stops admitting and evicting 
whole-window comparisons whose stored windows last at least as long as the 
other input's, such as the 10-second tumbling windows on both inputs in the new 
rejection test, and master and Spark 4.3.0 handle that case correctly. An 
evicted window starts at or before the watermark minus its own duration, while 
every later window of the other input ends after the watermark and so starts 
after the watermark minus its own duration. When that duration is no longer 
than the stored window's, the later window starts after the evicted one and 
orders above it, so it cannot match.
   
   These queries now fail analysis as left outer, right outer or left semi 
joins. As inner joins, they keep that input's state without bound and hold back 
the join's output watermark for that input, so an append-mode aggregation over 
that window after the join stops emitting results. Setting 
`spark.sql.streaming.join.checkFinalization.enabled` to `false` does not bring 
the old behavior back: an outer join then runs but never emits those unmatched 
windows. That the join guide does not document this form does not settle it, 
because these queries return correct results on released versions and break on 
upgrade.
   
   So I still consider this blocking: such comparisons need to yield a cutoff 
again, for example by recording each window's duration where `window()` is 
resolved, while comparisons whose stored windows are shorter keep yielding none.
   
   <!-- SPARK_DEV_REVIEW_REPLY 
{"feedback_id":"inline:4523339214","thread_id":"inline:4523339214","verdict_sha256":"db53cd06e263a426cfa74c746996e20ac99259c62ad0fa45c1851fff96613b51"}
 -->



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