spark-test commented on code in PR #60282:
URL: https://github.com/apache/spark/pull/60282#discussion_r4523762411
##########
sql/core/src/test/scala/org/apache/spark/sql/execution/streaming/state/SymmetricHashJoinStateManagerSuite.scala:
##########
@@ -1184,6 +1305,48 @@ class SymmetricHashJoinStateManagerEventTimeInValueSuite
}
}
+ versionsInTest.foreach { ver =>
+ test(s"StreamingJoinStateManager V$ver - null indexed time is not
evicted") {
+ withJoinStateManager(inputValueAttributes, joinKeyExpressions, ver) {
manager =>
+ implicit val mgr = manager
+ // `time <= threshold` is unknown for a null time, so value eviction
keeps the row.
+ manager.append(toJoinKeyRow(40), toInputValueWithNullTime(40), matched
= false)
+ append(40, 10)
+ assert(removeByValue(20) === 1)
+ assert(manager.get(toJoinKeyRow(40)).map(_.isNullAt(1)).toSeq ===
Seq(true))
+ }
+ }
+ }
+
+ test("StreamingJoinStateManager V4 - null indexed time survives evicting
real rows") {
+ withJoinStateManager(inputValueAttributes, joinKeyExpressions,
stateFormatVersion = 4) {
+ manager =>
+ implicit val mgr = manager
+ manager.append(toJoinKeyRow(40), toInputValueWithNullTime(40), matched
= false)
+ // Put a real row at every timestamp that a random bucket for rows
without a timestamp
Review Comment:
**Nit (P3):** The suite's `time` column carries watermark metadata, so this
V4 side has a timestamp index and `append` stores the null-time row at
`Long.MinValue` plus a bucket, never at 0..1023. The real rows never share its
`(key, timestamp)` list. The test passes because the lists are kept apart, and
it fails only if the offset is lost. Read literally, the comment suggests that
evicting a list shared with a null-time row is safe, while the implementation's
own comment says that sharing a list would remove the null-time row.
**Verification:**
- **Inspection:** The comment says the rows at 0 to 1023 detect a missing
offset rather than claiming they share a list with the row without a timestamp.
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/UnsupportedOperationChecker.scala:
##########
@@ -706,32 +707,44 @@ object UnsupportedOperationChecker extends Logging {
}
private def checkForStreamStreamJoinWatermark(join: Join): Unit = {
- val watermarkInJoinKeys = StreamingJoinHelper.isWatermarkInJoinKeys(join)
-
- // Check if the nullable side has a watermark, and there's a range
condition which
- // implies a state value watermark on the first side.
- val hasValidWatermarkRange = join.joinType match {
- case LeftOuter | LeftSemi => StreamingJoinHelper.getStateValueWatermark(
- join.left.outputSet, join.right.outputSet, join.condition,
Some(1000000)).isDefined
- case RightOuter => StreamingJoinHelper.getStateValueWatermark(
- join.right.outputSet, join.left.outputSet, join.condition,
Some(1000000)).isDefined
- case FullOuter =>
- Seq((join.left.outputSet, join.right.outputSet),
- (join.right.outputSet, join.left.outputSet)).exists {
- case (attributesToFindStateWatermarkFor,
attributesWithEventWatermark) =>
-
StreamingJoinHelper.getStateValueWatermark(attributesToFindStateWatermarkFor,
- attributesWithEventWatermark, join.condition,
Some(1000000)).isDefined
- }
+ val keys = ExtractEquiJoinKeys.unapply(join)
+ val leftKeys = keys.map(_._2).getOrElse(Nil)
+ val rightKeys = keys.map(_._3).getOrElse(Nil)
+
+ def canEvictState(
Review Comment:
**Nit (P3):** This check admits an outer or semi join whenever the solver
finds a bound for any stored-side column. That includes `rightTime <=
CAST(expiry AS TIMESTAMP)` with a BIGINT `expiry`, which eviction never uses,
and a constant-only conjunct, whose cutoff does not follow the opposite
watermark. The description leaves both to SPARK-61348 and SPARK-61349, but
neither this method nor `getStateValueWatermarkForInput` says so. A TODO here
and there, naming both tickets and the inputs they leave unfinalized, would
show readers that the fix is partial.
**Verification:**
- **Inspection:** canEvictState and getStateValueWatermarkForInput each name
SPARK-61348 and SPARK-61349 and the inputs those tickets leave unfinalized.
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/UnsupportedOperationChecker.scala:
##########
@@ -706,32 +707,44 @@ object UnsupportedOperationChecker extends Logging {
}
private def checkForStreamStreamJoinWatermark(join: Join): Unit = {
- val watermarkInJoinKeys = StreamingJoinHelper.isWatermarkInJoinKeys(join)
-
- // Check if the nullable side has a watermark, and there's a range
condition which
- // implies a state value watermark on the first side.
- val hasValidWatermarkRange = join.joinType match {
- case LeftOuter | LeftSemi => StreamingJoinHelper.getStateValueWatermark(
- join.left.outputSet, join.right.outputSet, join.condition,
Some(1000000)).isDefined
- case RightOuter => StreamingJoinHelper.getStateValueWatermark(
- join.right.outputSet, join.left.outputSet, join.condition,
Some(1000000)).isDefined
- case FullOuter =>
- Seq((join.left.outputSet, join.right.outputSet),
- (join.right.outputSet, join.left.outputSet)).exists {
- case (attributesToFindStateWatermarkFor,
attributesWithEventWatermark) =>
-
StreamingJoinHelper.getStateValueWatermark(attributesToFindStateWatermarkFor,
- attributesWithEventWatermark, join.condition,
Some(1000000)).isDefined
- }
+ val keys = ExtractEquiJoinKeys.unapply(join)
+ val leftKeys = keys.map(_._2).getOrElse(Nil)
+ val rightKeys = keys.map(_._3).getOrElse(Nil)
+
+ def canEvictState(
+ stateInput: LogicalPlan,
+ otherInput: LogicalPlan,
+ otherKeys: Seq[Expression]): Boolean = {
+ val eventTime =
otherInput.output.find(_.metadata.contains(EventTimeWatermark.delayKey))
+ StreamingJoinHelper.getStateKeyWatermarkOrdinal(otherKeys,
otherInput.output).isDefined ||
+ StreamingJoinHelper.getStateValueWatermark(stateInput.outputSet,
Review Comment:
**Non-blocking (P2):** `canEvictState` passes every stored-side column to
`getStateValueWatermark`, and `collectTerms` reads a column through any
`CAST(... AS TIMESTAMP)`, including the one coercion adds when a DATE or
TIMESTAMP_NTZ column is compared with the opposite TIMESTAMP event time. So
`orders LEFT OUTER JOIN shipments ON o.orderId = s.orderId AND o.orderDate >=
s.shipTime - INTERVAL 7 DAYS`, with a watermark only on `shipTime`, passes
analysis. At run time `getStateValueWatermarkForInput` tries only the
event-time column and `TimestampType` columns, so the left side gets no
predicate: orders are never evicted and unmatched orders are never emitted, the
failure this PR fixes for TIMESTAMP bounds. Any other non-TIMESTAMP,
non-numeric column read through a cast to TIMESTAMP, such as a STRING column,
behaves the same. The description defers only numeric bounds (SPARK-61348), so
these types are an unmarked gap in the fix.
**Verification:**
- **Regression:** Left outer, right outer, full outer, and left semi joins
whose only stored-side bound goes through a DATE, TIMESTAMP_NTZ, or STRING
column are rejected at analysis.
- **Compatibility:** Joins bounded through the stored side's event time or
other TIMESTAMP columns, and those bounded through numeric columns pending the
later stack PR, are admitted as before.
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/StreamingJoinHelper.scala:
##########
@@ -35,18 +34,130 @@ import org.apache.spark.unsafe.types.CalendarInterval
object StreamingJoinHelper extends PredicateHelper with Logging {
/**
- * Check the provided logical plan to see if its join keys contain a
watermark attribute.
- *
- * Will return false if the plan is not an equijoin.
- * @param plan the logical plan to check
+ * Find the equality key filtered by this input's watermark. Its ordinal can
be used to
+ * evict the opposite input's state, whose equality keys have the same
ordering.
+ * For leftTime = rightTime, a watermark on rightTime bounds leftTime even
when leftTime
+ * has no watermark. It does not bound right-side state without a watermark
on leftTime.
+ * A key computed from the event time by adding a constant interval, such as
+ * leftTime = rightTime + INTERVAL 10 SECONDS, is bounded too; see
[[getStateKeyWatermark]].
*/
- def isWatermarkInJoinKeys(plan: LogicalPlan): Boolean = {
- plan match {
- case ExtractEquiJoinKeys(_, leftKeys, rightKeys, _, _, _, _, _) =>
- (leftKeys ++ rightKeys).exists {
- case a: AttributeReference =>
a.metadata.contains(EventTimeWatermark.delayKey)
- case _ => false
- }
+ def getStateKeyWatermarkOrdinal(
+ keys: Seq[Expression],
+ inputAttributes: Seq[Attribute]): Option[Int] = {
+ getEventTimeKeyOrdinal(keys, inputAttributes).orElse {
+ keys.indices.find(getStateKeyWatermark(keys, inputAttributes, _,
Some(0L)).isDefined)
+ }
+ }
+
+ /** Find the equality key that is this input's event-time column itself. */
+ def getEventTimeKeyOrdinal(
+ keys: Seq[Expression],
+ inputAttributes: Seq[Attribute]): Option[Int] = {
+ // When multiple stateful operators are disabled, late filtering uses the
first event-time
+ // column. Otherwise, execution rejects multiple distinct event-time
columns.
+ inputAttributes.find(_.metadata.contains(delayKey)).flatMap { eventTime =>
+ keys.indexWhere(_.semanticEquals(eventTime)) match {
+ case ordinal if ordinal >= 0 => Some(ordinal)
+ case _ => None
+ }
+ }
+ }
+
+ /**
+ * Get the cutoff for the opposite input's equality key at `ordinal`, given
this input's
+ * watermark. `keys` and `inputAttributes` belong to this input, whose
future rows have an event
+ * time above the watermark. When the key is that event time, the equal key
of any state row
+ * they can still match is above the watermark too. When the key is the
event time shifted by
+ * an interval, solving `stateKey >= rightTime + INTERVAL 10 SECONDS` shifts
the cutoff by that
+ * interval, less 1 ms as for range conditions. Returns None for any other
key.
+ */
+ def getStateKeyWatermark(
+ keys: Seq[Expression],
+ inputAttributes: Seq[Attribute],
+ ordinal: Int,
+ eventWatermark: Option[Long]): Option[Long] = {
+ if (getEventTimeKeyOrdinal(keys, inputAttributes).contains(ordinal)) {
+ eventWatermark
+ } else {
+ eventTimeOfKey(keys(ordinal), inputAttributes).flatMap { eventTime =>
Review Comment:
**Blocking (P1):** For a key on the opposite event time that
`isIntervalShift` does not accept as exact, `getStateKeyWatermark` falls
through here to no bound. Examples are `lk = rk AND lt = rt + INTERVAL 1 DAY`
in America/Los_Angeles, a shift with a month or year part, and a `timestampadd`
key. With watermarks on both inputs, the left side then has neither a key bound
nor a range bound. An inner join keeps every left row for the life of the
query. Left outer, left semi, and full outer joins now fail analysis with
'requires a watermark on the right input and a time constraint', although the
query has both; this PR's own `UnsupportedOperationsSuite` case for
America/Los_Angeles asserts the rejection. On the base branch, the watermarked
key `lt` evicted left rows at `lt <= wm`. That is sound for any non-negative
shift: a future right row has `rt` above the watermark, so its key is above it
too. The 24-hour-day concern behind the exactness check makes only the shifted
cutoff unsafe,
not this unshifted one. Right outer joins of this shape are still admitted,
and negative shifts, which were unsound on the base branch, are not part of
this finding.
See **Shared repair plan 1** in the review body.
##########
sql/core/src/test/scala/org/apache/spark/sql/streaming/StreamingJoinEqualityWatermarkSuite.scala:
##########
@@ -0,0 +1,277 @@
+/*
+ * 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 org.apache.spark.sql.Row
+import
org.apache.spark.sql.execution.streaming.operators.stateful.join.StreamingSymmetricHashJoinExec
+import
org.apache.spark.sql.execution.streaming.operators.stateful.join.StreamingSymmetricHashJoinHelper.{JoinStateKeyWatermarkPredicate,
JoinStateValueWatermarkPredicate}
+import org.apache.spark.sql.execution.streaming.runtime.MemoryStream
+import org.apache.spark.sql.execution.streaming.state.RocksDBStateStoreProvider
+import org.apache.spark.sql.functions._
+import org.apache.spark.sql.internal.SQLConf
+
+class StreamingJoinEqualityWatermarkSuite extends StreamTest {
+ import testImplicits._
+
+ for {
+ version <- Seq(2, 3, 4)
+ restart <- Seq(false, true)
+ } {
+ test(s"equality eviction follows the opposite watermark, V$version
restart=$restart") {
+ withSQLConf(
+ SQLConf.STREAMING_JOIN_STATE_FORMAT_VERSION.key -> version.toString,
+ SQLConf.STATE_STORE_PROVIDER_CLASS.key ->
classOf[RocksDBStateStoreProvider].getName,
+ SQLConf.STREAMING_NO_DATA_MICRO_BATCHES_ENABLED.key -> "false") {
+ val leftInput = MemoryStream[(Int, Int)]
+ val rightInput = MemoryStream[(Int, Int)]
+ val left = leftInput.toDF().toDF("a", "b")
+ .select(timestamp_seconds($"a").as("la"),
timestamp_seconds($"b").as("lb"))
+ .withWatermark("la", "10 seconds")
+ val right = rightInput.toDF().toDF("a", "b")
+ .select(timestamp_seconds($"a").as("ra"),
timestamp_seconds($"b").as("rb"))
+ .withWatermark("rb", "10 seconds")
+ val joined = left.join(right, expr("la = ra AND lb = rb"),
"full_outer")
+ .select($"la".cast("int"), $"lb".cast("int"),
+ $"ra".cast("int"), $"rb".cast("int"))
+ withTempDir { checkpoint =>
+ val restartActions = if (restart) {
+ Seq(StopStream, StartStream(checkpointLocation =
checkpoint.getCanonicalPath))
+ } else {
+ Nil
+ }
+ testStream(joined)((Seq(
+ StartStream(checkpointLocation = checkpoint.getCanonicalPath),
+ MultiAddData(leftInput, (5, 50))(rightInput, (80, 50)),
+ CheckNewAnswer(),
+ MultiAddData(leftInput, (60, 100))(rightInput, (70, 50)),
+ CheckNewAnswer(),
+ AddData(leftInput, (70, 100)),
+ // At watermark 40, left (5, 50) can still match fresh right input
on rb=50.
+ CheckNewAnswer()) ++ restartActions ++ Seq(
+ AddData(rightInput, (5, 50)),
+ CheckNewAnswer(Row(5, 50, 5, 50)),
+ // Fresh on la, but already expired on lb: V4 must visit it below
the old cutoff.
+ AddData(leftInput, (90, 10)),
+ CheckNewAnswer(Row(90, 10, null, null)),
+ MultiAddData(leftInput, (200, 200))(rightInput, (200, 200)),
+ CheckNewAnswer(Row(200, 200, 200, 200)),
+ MultiAddData(leftInput, (210, 210))(rightInput, (210, 210)),
+ CheckNewAnswer(Row(210, 210, 210, 210), Row(60, 100, null, null),
+ Row(70, 100, null, null), Row(null, null, 80, 50), Row(null,
null, 70, 50))
+ )): _*)
+ }
+ }
+ }
+ }
+
+ test("V4 window equality retains state for future unwatermarked input") {
+ withSQLConf(
+ SQLConf.STREAMING_JOIN_STATE_FORMAT_VERSION.key -> "4",
+ SQLConf.STATE_STORE_PROVIDER_CLASS.key ->
classOf[RocksDBStateStoreProvider].getName) {
+ val leftInput = MemoryStream[Int]
+ val rightInput = MemoryStream[Int]
+ val left = leftInput.toDF()
+ .select($"value".as("key"), timestamp_seconds($"value").as("time"))
+ .withWatermark("time", "10 seconds")
+ .select($"key", window($"time", "10 seconds"))
+ val right = rightInput.toDF()
+ .select($"value".as("key"), timestamp_seconds($"value").as("time"))
+ .select($"key", window($"time", "10 seconds"))
+ val joined = left.join(right, Seq("key", "window"))
+ .select($"key", $"window.end".cast("long"))
+ testStream(joined)(
+ AddData(leftInput, 1), CheckNewAnswer(),
+ AddData(rightInput, 1), CheckNewAnswer(Row(1, 10L)),
+ AddData(leftInput, 25), CheckNewAnswer(),
+ StopStream, StartStream(),
+ // The right input has no late filter; its old window must still find
left state.
+ AddData(rightInput, 1), CheckNewAnswer(Row(1, 10L)),
+ AddData(leftInput, 5), CheckNewAnswer())
+ }
+ }
+
+ for {
+ version <- Seq(2, 3, 4)
+ offset <- Seq(10, -10)
+ } {
+ test(s"equality on a shifted opposite event time evicts state, V$version
offset=$offset") {
+ withSQLConf(
+ SQLConf.STREAMING_JOIN_STATE_FORMAT_VERSION.key -> version.toString,
+ SQLConf.STATE_STORE_PROVIDER_CLASS.key ->
classOf[RocksDBStateStoreProvider].getName,
+ SQLConf.STREAMING_NO_DATA_MICRO_BATCHES_ENABLED.key -> "false") {
+ val leftInput = MemoryStream[(Int, Int)]
+ val rightInput = MemoryStream[(Int, Int)]
+ val left = leftInput.toDF().toDF("lk", "lt")
+ .select($"lk", timestamp_seconds($"lt").as("lt"))
+ .withWatermark("lt", "10 seconds")
+ val right = rightInput.toDF().toDF("rk", "rt")
+ .select($"rk", timestamp_seconds($"rt").as("rt"))
+ .withWatermark("rt", "10 seconds")
+ // A left row matches the right row whose time is `offset` seconds
earlier.
+ val joined = left.join(right,
+ expr(s"lk = rk AND lt = rt + INTERVAL $offset SECONDS"),
"left_outer")
+ .select($"lk", $"lt".cast("int"), $"rk", $"rt".cast("int"))
+ testStream(joined)(
+ MultiAddData(leftInput, (1, 100 + offset), (2, 90 + offset), (3, 145
+ offset))(
Review Comment:
**Non-blocking (P2):** For `offset = 10`, the only unmatched left row, `(2,
100)`, lies above the previous shifted cutoff (99.999 s) when it is evicted. By
our reading, the test therefore passes with or without the `.filter(_ <=
lateWatermark)` that protects the V4 scan start.
`StreamingSymmetricHashJoinHelperSuite` checks the previous watermark only for
unshifted keys. Suppose the filter were dropped and the previous cutoff `lateWm
+ 10 s - 1 ms` used directly. A left row such as `(4, 95)`, arriving in the
batch whose late watermark is 90 s, would pass late filtering but fall below
the scan range `(99.999, 149.999]`. It would never be evicted or emitted padded
with nulls, and no test would fail. The negative-offset case does exercise its
own boundary.
See **Shared repair plan 2** in the review body.
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/operators/stateful/join/StreamingSymmetricHashJoinHelper.scala:
##########
@@ -224,98 +228,150 @@ object StreamingSymmetricHashJoinHelper extends Logging {
WatermarkSupport.findEventTimeColumn(rightAttributes,
allowMultipleEventTimeColumns = useFirstEventTimeColumn)
- val joinKeyOrdinalForWatermark: Option[Int] =
findJoinKeyOrdinalForWatermark(
- leftKeys, rightKeys)
-
def getOneSideStateWatermarkPredicate(
oneSideInputAttributes: Seq[Attribute],
oneSideJoinKeys: Seq[Expression],
- otherSideInputAttributes: Seq[Attribute]):
Option[JoinStateWatermarkPredicate] = {
- val isWatermarkDefinedOnInput =
oneSideInputAttributes.exists(_.metadata.contains(delayKey))
+ otherSideInputAttributes: Seq[Attribute],
+ otherSideJoinKeys: Seq[Expression]):
Option[JoinStateWatermarkPredicate] = {
+ // State is bounded by future input from the opposite side, not by its
own watermark.
+ val joinKeyOrdinalForWatermark =
StreamingJoinHelper.getStateKeyWatermarkOrdinal(
+ otherSideJoinKeys, otherSideInputAttributes)
val isWatermarkDefinedOnJoinKey = joinKeyOrdinalForWatermark.isDefined
if (isWatermarkDefinedOnJoinKey) { // case 1 and 3 in the
StreamingSymmetricHashJoinExec docs
+ val ordinal = joinKeyOrdinalForWatermark.get
val keyExprWithWatermark = BoundReference(
- joinKeyOrdinalForWatermark.get,
- oneSideJoinKeys(joinKeyOrdinalForWatermark.get).dataType,
- oneSideJoinKeys(joinKeyOrdinalForWatermark.get).nullable)
- val expr = watermarkExpression(Some(keyExprWithWatermark),
eventTimeWatermarkForEviction)
- expr.map { e =>
- // V4 can skip keys at or below the previous watermark only if
late-input filtering
- // rejects new rows in that range on this same key. A watermark on
the other input's
- // equality key can drive eviction even when this input has no
watermark, or has one
- // on a different column. New rows can then pass late-input
filtering with keys
- // already eligible for eviction. V4 must scan from the beginning to
find them;
- // otherwise, outer joins can fail to emit null rows for these
unmatched inputs.
- val prevStateKeyWatermark =
- if (oneSideInputAttributes.find(_.metadata.contains(delayKey))
-
.exists(oneSideJoinKeys(joinKeyOrdinalForWatermark.get).semanticEquals)) {
- eventTimeWatermarkForLateEvents
- } else {
- None
- }
- // watermarkExpression only provides the expression when
eventTimeWatermarkForEviction
- // is defined.
- JoinStateKeyWatermarkPredicate(
- e,
- eventTimeWatermarkForEviction.get,
- prevStateKeyWatermark)
- }
- } else if (isWatermarkDefinedOnInput) { // case 2 in the
StreamingSymmetricHashJoinExec docs
- val stateValueWatermark = StreamingJoinHelper.getStateValueWatermark(
- attributesToFindStateWatermarkFor =
AttributeSet(oneSideInputAttributes),
- attributesWithEventWatermark =
AttributeSet(otherSideInputAttributes),
- condition,
- eventTimeWatermarkForEviction)
- // A row can pass late-input filtering but already be eligible for
eviction in this batch.
- // When the previous join-derived state cutoff is ahead of the
late-input watermark, a new
- // row can fall at or below that cutoff. V4 must scan from the
beginning to find such rows.
- val prevStateValueWatermark = eventTimeWatermarkForLateEvents.flatMap
{ lateWatermark =>
- StreamingJoinHelper.getStateValueWatermark(
- attributesToFindStateWatermarkFor =
AttributeSet(oneSideInputAttributes),
- attributesWithEventWatermark =
AttributeSet(otherSideInputAttributes),
- condition,
- eventTimeWatermarkForLateEvents).filter(_ <= lateWatermark)
+ ordinal, oneSideJoinKeys(ordinal).dataType,
oneSideJoinKeys(ordinal).nullable)
+ // The opposite watermark bounds this key, shifted by any constant in
the opposite key.
+ def keyWatermark(watermark: Option[Long]): Option[Long] =
+ StreamingJoinHelper.getStateKeyWatermark(
+ otherSideJoinKeys, otherSideInputAttributes, ordinal, watermark)
+ keyWatermark(eventTimeWatermarkForEviction).flatMap { stateWatermark =>
+ watermarkExpression(Some(keyExprWithWatermark),
Some(stateWatermark)).map { e =>
+ // V4 can skip keys at or below the previous watermark only if
late-input filtering
+ // rejects new rows in that range on this same key. A watermark on
the other input's
+ // equality key can drive eviction even when this input has no
watermark, or has one
+ // on a different column. New rows can then pass late-input
filtering with keys
+ // already eligible for eviction. V4 must scan from the beginning
to find them;
+ // otherwise, outer joins can fail to emit null rows for these
unmatched inputs.
+ val prevStateKeyWatermark =
+ if (oneSideInputAttributes.find(_.metadata.contains(delayKey))
+ .exists(oneSideJoinKeys(ordinal).semanticEquals)) {
+ // A cutoff shifted above the late-input watermark also needs
a full scan.
+ eventTimeWatermarkForLateEvents.flatMap { lateWatermark =>
+ keyWatermark(Some(lateWatermark)).filter(_ <= lateWatermark)
+ }
+ } else {
+ None
+ }
+ JoinStateKeyWatermarkPredicate(e, stateWatermark,
prevStateKeyWatermark)
+ }
}
- val inputAttributeWithWatermark =
oneSideInputAttributes.find(_.metadata.contains(delayKey))
- val expr = watermarkExpression(inputAttributeWithWatermark,
stateValueWatermark)
- expr.map { e =>
- // watermarkExpression only provides the expression when
eventTimeWatermarkForEviction
- // is defined
- JoinStateValueWatermarkPredicate(e, stateValueWatermark.get,
prevStateValueWatermark)
+ } else { // case 2 in the StreamingSymmetricHashJoinExec docs
+ // Future matches are limited by the opposite watermark. This input
needs no watermark;
+ // its event-time column may also have been pruned from the physical
join.
+ val otherSideEventTime =
otherSideInputAttributes.find(_.metadata.contains(delayKey))
+ getStateValueWatermarkForInput(oneSideInputAttributes,
otherSideInputAttributes,
Review Comment:
**Blocking (P1):** With the own-watermark requirement gone from the `else`
branch above, a stored side without a watermark, or with a pruned event-time
column, now gets its value cutoff here. `collectTerms` counts a day-time
interval by its microseconds and a calendar day as `MICROS_PER_DAY`, so every
whole day counts as 24 hours. But `TimestampAddInterval` adds days in the
session time zone, so `impressionTime + INTERVAL 1 DAY` is 25 hours later
across a fall-back change. Here is how the code handles that in
America/Los_Angeles. Take a left outer join of impressions (no watermark) and
clicks (watermark on `clickTime`, no delay) on `adId = adId AND clickTime
BETWEEN impressionTime AND impressionTime + INTERVAL 1 DAY`. An impression at
2024-11-02T19:00Z can match clicks until 2024-11-03T20:00Z. Once the watermark
reaches 2024-11-03T19:10Z, the cutoff `wm - 86400001 ms` evicts the impression
and emits it padded with nulls. A click at 19:30Z in a later batch passes late
filtering and
finds nothing, so the result has a spurious null row and loses a match. On
the base branch this side was never evicted, so that click matched. The
equality-key path in this diff refuses whole-day shifts outside fixed-offset
zones for exactly this reason. Two-sided joins already evicted with this cutoff
on the base branch; this commit extends it to joins that never evicted.
**Recommended change:** In the time-constraint solver, bound each whole day
of an interval added in a time zone that is not fixed-offset by the shortest
local day when the term raises the solved bound and by the longest when it
lowers it, using the largest UTC-offset change in that zone's rules;
fixed-offset zones and sub-day parts keep their exact length. Because those
cutoffs then differ between session time zones, stop the first batch after a
restart from reusing a V4 eviction scan start computed under the current zone,
for example by scanning the V4 eviction index from its start in that batch. Add
join tests for a one-sided left outer join with a whole-day bound across a
fall-back change, for the two-sided equivalent, for the V4 probe window, and
for a V4 restart from a daylight-saving zone into UTC, plus solver tests for
both directions.
**Why this works:** The solver turns a constraint into stateColumn > the sum
of the other terms, and each term's sign in that sum is the negation flag
collectTerms already tracks. Counting a positive day term at its shortest and a
negative one at its longest keeps the solved value at or below every bound
local-day arithmetic can produce, so no consumer evicts, scans past, or
advances the watermark beyond a row that can still match. The V4 eviction scan
start is the one consumer that reads a cutoff computed for an earlier batch: it
takes the cutoff at the previous late watermark as the cutoff that batch used,
which holds within a run but not across a restart that changes the session time
zone, so the first batch after a restart must start lower.
**Scope:** Make the solver's day count conservative in daylight-saving
zones, keep V4 scan starts valid across a session time zone change, and add
tests across a fall-back change.
**Compatibility:** Joins whose bounds use sub-day intervals, or any interval
in a fixed-offset session time zone, keep their current cutoffs, output
watermarks, and V4 probe windows.
**Risks:** Two-sided range joins with whole-day bounds in daylight-saving
zones keep rows up to the zone's largest offset change per day longer, and
their V4 probe windows widen by the same amount; zones whose rules contain very
large historical changes keep proportionally more. No flag restores the 24-hour
count, which would restore early eviction. Scanning the V4 eviction index from
its start in the first batch after a restart adds one pass over the deletions
RocksDB has not yet compacted, once per restart.
**Constraints:** Exact intervals, meaning sub-day intervals and any interval
in a fixed-offset zone, must keep their current cutoffs. The direction rule
must hold for every consumer of the solved value: eviction cutoffs, key
cutoffs, output-watermark bounds, and both V4 range-scan offsets. A V4 eviction
scan start, for value or key eviction, must stay at or below the cutoff the
previous batch actually used, including in the first batch after a restart
under another session time zone, so no row left in state is skipped and never
evicted or emitted.
**Exclusions:**
- Months and years in range conditions stay unsolvable, as they are today.
**Success:** A left outer join of impressions without a watermark and clicks
with a watermark on `clickTime BETWEEN impressionTime AND impressionTime +
INTERVAL 1 DAY` in America/Los_Angeles keeps an impression until no click
inside its 25-hour fall-back day can still match, and emits no spurious null
row. Cutoffs for sub-day bounds and for any bound in UTC are unchanged.
**Verification:**
- **Regression:** In America/Los_Angeles, a one-sided left outer join with a
one-day range bound matches a click in the extra fall-back hour and does not
emit that impression padded with nulls, for state formats 2 to 4.
- **Behavior:** A two-sided range join with a one-day bound across a
spring-forward and a fall-back change in a daylight-saving zone produces every
match, and the V4 probe window includes rows at the edge of the 25-hour day.
- **Compatibility:** Cutoffs, output watermarks, and range-scan offsets for
sub-day bounds and for whole-day bounds in UTC equal their current values.
- **Regression:** With state format V4, a two-sided left outer join with a
one-day range bound that buffers left rows in America/Los_Angeles and restarts
under UTC evicts every left row buffered before the restart once the right
watermark passes it and emits the unmatched ones padded with nulls.
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/operators/stateful/join/StreamingSymmetricHashJoinHelper.scala:
##########
@@ -224,98 +228,150 @@ object StreamingSymmetricHashJoinHelper extends Logging {
WatermarkSupport.findEventTimeColumn(rightAttributes,
allowMultipleEventTimeColumns = useFirstEventTimeColumn)
- val joinKeyOrdinalForWatermark: Option[Int] =
findJoinKeyOrdinalForWatermark(
- leftKeys, rightKeys)
-
def getOneSideStateWatermarkPredicate(
oneSideInputAttributes: Seq[Attribute],
oneSideJoinKeys: Seq[Expression],
- otherSideInputAttributes: Seq[Attribute]):
Option[JoinStateWatermarkPredicate] = {
- val isWatermarkDefinedOnInput =
oneSideInputAttributes.exists(_.metadata.contains(delayKey))
+ otherSideInputAttributes: Seq[Attribute],
+ otherSideJoinKeys: Seq[Expression]):
Option[JoinStateWatermarkPredicate] = {
+ // State is bounded by future input from the opposite side, not by its
own watermark.
+ val joinKeyOrdinalForWatermark =
StreamingJoinHelper.getStateKeyWatermarkOrdinal(
+ otherSideJoinKeys, otherSideInputAttributes)
val isWatermarkDefinedOnJoinKey = joinKeyOrdinalForWatermark.isDefined
if (isWatermarkDefinedOnJoinKey) { // case 1 and 3 in the
StreamingSymmetricHashJoinExec docs
+ val ordinal = joinKeyOrdinalForWatermark.get
val keyExprWithWatermark = BoundReference(
- joinKeyOrdinalForWatermark.get,
- oneSideJoinKeys(joinKeyOrdinalForWatermark.get).dataType,
- oneSideJoinKeys(joinKeyOrdinalForWatermark.get).nullable)
- val expr = watermarkExpression(Some(keyExprWithWatermark),
eventTimeWatermarkForEviction)
- expr.map { e =>
- // V4 can skip keys at or below the previous watermark only if
late-input filtering
- // rejects new rows in that range on this same key. A watermark on
the other input's
- // equality key can drive eviction even when this input has no
watermark, or has one
- // on a different column. New rows can then pass late-input
filtering with keys
- // already eligible for eviction. V4 must scan from the beginning to
find them;
- // otherwise, outer joins can fail to emit null rows for these
unmatched inputs.
- val prevStateKeyWatermark =
- if (oneSideInputAttributes.find(_.metadata.contains(delayKey))
-
.exists(oneSideJoinKeys(joinKeyOrdinalForWatermark.get).semanticEquals)) {
- eventTimeWatermarkForLateEvents
- } else {
- None
- }
- // watermarkExpression only provides the expression when
eventTimeWatermarkForEviction
- // is defined.
- JoinStateKeyWatermarkPredicate(
- e,
- eventTimeWatermarkForEviction.get,
- prevStateKeyWatermark)
- }
- } else if (isWatermarkDefinedOnInput) { // case 2 in the
StreamingSymmetricHashJoinExec docs
- val stateValueWatermark = StreamingJoinHelper.getStateValueWatermark(
- attributesToFindStateWatermarkFor =
AttributeSet(oneSideInputAttributes),
- attributesWithEventWatermark =
AttributeSet(otherSideInputAttributes),
- condition,
- eventTimeWatermarkForEviction)
- // A row can pass late-input filtering but already be eligible for
eviction in this batch.
- // When the previous join-derived state cutoff is ahead of the
late-input watermark, a new
- // row can fall at or below that cutoff. V4 must scan from the
beginning to find such rows.
- val prevStateValueWatermark = eventTimeWatermarkForLateEvents.flatMap
{ lateWatermark =>
- StreamingJoinHelper.getStateValueWatermark(
- attributesToFindStateWatermarkFor =
AttributeSet(oneSideInputAttributes),
- attributesWithEventWatermark =
AttributeSet(otherSideInputAttributes),
- condition,
- eventTimeWatermarkForLateEvents).filter(_ <= lateWatermark)
+ ordinal, oneSideJoinKeys(ordinal).dataType,
oneSideJoinKeys(ordinal).nullable)
+ // The opposite watermark bounds this key, shifted by any constant in
the opposite key.
+ def keyWatermark(watermark: Option[Long]): Option[Long] =
+ StreamingJoinHelper.getStateKeyWatermark(
+ otherSideJoinKeys, otherSideInputAttributes, ordinal, watermark)
+ keyWatermark(eventTimeWatermarkForEviction).flatMap { stateWatermark =>
+ watermarkExpression(Some(keyExprWithWatermark),
Some(stateWatermark)).map { e =>
+ // V4 can skip keys at or below the previous watermark only if
late-input filtering
+ // rejects new rows in that range on this same key. A watermark on
the other input's
+ // equality key can drive eviction even when this input has no
watermark, or has one
+ // on a different column. New rows can then pass late-input
filtering with keys
+ // already eligible for eviction. V4 must scan from the beginning
to find them;
+ // otherwise, outer joins can fail to emit null rows for these
unmatched inputs.
+ val prevStateKeyWatermark =
+ if (oneSideInputAttributes.find(_.metadata.contains(delayKey))
+ .exists(oneSideJoinKeys(ordinal).semanticEquals)) {
+ // A cutoff shifted above the late-input watermark also needs
a full scan.
+ eventTimeWatermarkForLateEvents.flatMap { lateWatermark =>
+ keyWatermark(Some(lateWatermark)).filter(_ <= lateWatermark)
Review Comment:
**Non-blocking (P2):** Take a side whose key is its own event time while the
opposite key adds a positive interval, such as the left side of `lt = rt +
INTERVAL 10 SECONDS`. Its previous cutoff, `lateWm + 10 s - 1 ms`, is above
`lateWm`, so this filter yields `None`. Every V4 eviction then calls
`scanEvictedKeys(cutoff, None)` and seeks from the start of the `TsWithKey`
column family, walking each deletion earlier evictions left that RocksDB has
not compacted. On the base branch this key was scanned from the late watermark.
No row at or below the late watermark can remain, because earlier batches
evicted up to a higher cutoff and late filtering drops new ones, so
`map(math.min(_, lateWatermark))` gives a bounded start with the same results.
The cost depends on compaction and has not been measured, and V4 is an opt-in
state format.
See **Shared repair plan 2** in the review body.
##########
sql/core/src/test/scala/org/apache/spark/sql/streaming/StreamingJoinV4Suite.scala:
##########
@@ -321,7 +321,7 @@ class StreamingInnerJoinV4Suite
val df2 = input2.toDF().toDF("key", "time")
.select($"key", timestamp_seconds($"time") as "ts", ($"key" * 3) as
"rightValue")
// Only left side has watermark; ts is part of the join key, so
- // joinKeyOrdinalForWatermark is defined -> hasEventTime = true for both
sides.
+ // joinKeyOrdinalForWatermark is defined -> hasTimestampForEviction =
true for both sides.
Review Comment:
**Nit (P3):** After this change only the right manager gets a key ordinal:
ordinal 1, from `df1`'s watermarked `ts`. The left manager gets none because
`df2` has no watermark. The left secondary index is populated only because the
value timestamp falls back to `df1`'s watermarked `ts`, and left state is never
evicted. This comment, the one at lines 350-351, and the batch-zero note about
evicting rows with `ts <= 10` still describe the shared ordinal this PR
removes, in which a watermark on one side's key evicts both sides.
**Verification:**
- **Inspection:** The test's comments say which side gets a key ordinal, why
the left index is populated, and that only right state is evicted.
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/StreamingJoinHelper.scala:
##########
@@ -35,18 +34,130 @@ import org.apache.spark.unsafe.types.CalendarInterval
object StreamingJoinHelper extends PredicateHelper with Logging {
/**
- * Check the provided logical plan to see if its join keys contain a
watermark attribute.
- *
- * Will return false if the plan is not an equijoin.
- * @param plan the logical plan to check
+ * Find the equality key filtered by this input's watermark. Its ordinal can
be used to
+ * evict the opposite input's state, whose equality keys have the same
ordering.
+ * For leftTime = rightTime, a watermark on rightTime bounds leftTime even
when leftTime
+ * has no watermark. It does not bound right-side state without a watermark
on leftTime.
+ * A key computed from the event time by adding a constant interval, such as
+ * leftTime = rightTime + INTERVAL 10 SECONDS, is bounded too; see
[[getStateKeyWatermark]].
*/
- def isWatermarkInJoinKeys(plan: LogicalPlan): Boolean = {
- plan match {
- case ExtractEquiJoinKeys(_, leftKeys, rightKeys, _, _, _, _, _) =>
- (leftKeys ++ rightKeys).exists {
- case a: AttributeReference =>
a.metadata.contains(EventTimeWatermark.delayKey)
- case _ => false
- }
+ def getStateKeyWatermarkOrdinal(
+ keys: Seq[Expression],
+ inputAttributes: Seq[Attribute]): Option[Int] = {
+ getEventTimeKeyOrdinal(keys, inputAttributes).orElse {
+ keys.indices.find(getStateKeyWatermark(keys, inputAttributes, _,
Some(0L)).isDefined)
+ }
+ }
+
+ /** Find the equality key that is this input's event-time column itself. */
+ def getEventTimeKeyOrdinal(
+ keys: Seq[Expression],
+ inputAttributes: Seq[Attribute]): Option[Int] = {
+ // When multiple stateful operators are disabled, late filtering uses the
first event-time
+ // column. Otherwise, execution rejects multiple distinct event-time
columns.
+ inputAttributes.find(_.metadata.contains(delayKey)).flatMap { eventTime =>
+ keys.indexWhere(_.semanticEquals(eventTime)) match {
+ case ordinal if ordinal >= 0 => Some(ordinal)
+ case _ => None
+ }
+ }
+ }
+
+ /**
+ * Get the cutoff for the opposite input's equality key at `ordinal`, given
this input's
+ * watermark. `keys` and `inputAttributes` belong to this input, whose
future rows have an event
+ * time above the watermark. When the key is that event time, the equal key
of any state row
+ * they can still match is above the watermark too. When the key is the
event time shifted by
+ * an interval, solving `stateKey >= rightTime + INTERVAL 10 SECONDS` shifts
the cutoff by that
+ * interval, less 1 ms as for range conditions. Returns None for any other
key.
+ */
+ def getStateKeyWatermark(
+ keys: Seq[Expression],
+ inputAttributes: Seq[Attribute],
+ ordinal: Int,
+ eventWatermark: Option[Long]): Option[Long] = {
+ if (getEventTimeKeyOrdinal(keys, inputAttributes).contains(ordinal)) {
+ eventWatermark
+ } else {
+ eventTimeOfKey(keys(ordinal), inputAttributes).flatMap { eventTime =>
+ val stateKey = AttributeReference("stateKey", TimestampType)()
+ getStateValueWatermark(AttributeSet(Seq(stateKey)),
AttributeSet(Seq(eventTime)),
+ Some(GreaterThanOrEqual(stateKey, keys(ordinal))), eventWatermark)
+ }
+ }
+ }
+
+ /**
+ * Get a bound on this input's event time for state rows whose equality key
at `ordinal` is
+ * above `keyWatermark`. When the key is the event time, the bound is the
key watermark. When
+ * the key is the event time shifted by an interval, solving
+ * `leftTime + INTERVAL 10 SECONDS >= keyWatermark` subtracts that constant,
less 1 ms.
+ * Returns None for any other key.
+ */
+ def getEventTimeWatermarkFromKey(
+ keys: Seq[Expression],
+ inputAttributes: Seq[Attribute],
+ ordinal: Int,
+ keyWatermark: Long): Option[Long] = {
+ if (getEventTimeKeyOrdinal(keys, inputAttributes).contains(ordinal)) {
+ Some(keyWatermark)
+ } else {
+ eventTimeOfKey(keys(ordinal), inputAttributes).flatMap { eventTime =>
+ val keyWithWatermark = AttributeReference("stateKey", TimestampType,
+ metadata = new MetadataBuilder().putLong(delayKey, 0L).build())()
+ getStateValueWatermark(AttributeSet(Seq(eventTime)),
AttributeSet(Seq(keyWithWatermark)),
+ Some(GreaterThanOrEqual(keys(ordinal), keyWithWatermark)),
Some(keyWatermark))
+ }
+ }
+ }
+
+ /** The input's event-time column, if a timestamp key is that column shifted
by intervals. */
+ private def eventTimeOfKey(key: Expression, inputAttributes:
Seq[Attribute]): Option[Attribute] =
+ inputAttributes.find(_.metadata.contains(delayKey)).filter { eventTime =>
+ key.dataType == TimestampType && isIntervalShift(key, eventTime)
+ }
+
+ /**
+ * Whether the expression is the event time plus or minus constant
intervals. Other functions
+ * and casts from other types are not accepted: a truncation such as
+ * CAST(CAST(rightTime AS BIGINT) AS TIMESTAMP) can map a later event time
below the watermark.
+ */
+ private def isIntervalShift(expr: Expression, eventTime: Attribute): Boolean
= {
+ // Spark adds the whole days of an interval in the session time zone,
where a day can be 23
+ // or 25 hours across a daylight saving change, but the solver counts a
day as 24 hours.
+ // Accept whole days only in a fixed-offset time zone.
+ def isExactInterval(e: Expression, timeZoneId: Option[String]): Boolean = {
+ def fixedOffset: Boolean =
+ timeZoneId.exists(id =>
DateTimeUtils.getZoneId(id).getRules.isFixedOffset)
Review Comment:
**Blocking (P1):** Whether a whole-day shift counts as exact now depends on
this zone check. So whether the opposite key gives a V4 state manager an
ordinal depends on `spark.sql.session.timeZone`, which the offset log does not
pin. Take a V4 inner join on `l.k = r.rt + INTERVAL 1 DAY`, with a watermark
only on `r.rt` and `l.k` a TIMESTAMP column. Under America/Los_Angeles, the
left manager gets no ordinal, and `append` puts left rows in random buckets
0..1023 with no `TsWithKey` entry. After a restart from the same checkpoint
under UTC, the left manager gets ordinal 0, and right rows probing left state
read only `(key, keyTimestamp)`. By our reading of the code, every left row
buffered before the restart then becomes invisible: its matches are lost, and
key eviction never removes it. Nothing detects this, because the semantics
check skips version-4 markers and the state schemas are identical. On the base
branch the ordinal came from key metadata, so this query's layout did not de
pend on the zone. Only state format V4 is affected, and a restart in the other
direction only stops eviction of rows buffered before the restart.
See **Shared repair plan 1** in the review body.
##########
sql/core/src/test/scala/org/apache/spark/sql/streaming/StreamingJoinEqualityWatermarkSuite.scala:
##########
@@ -0,0 +1,277 @@
+/*
+ * 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 org.apache.spark.sql.Row
+import
org.apache.spark.sql.execution.streaming.operators.stateful.join.StreamingSymmetricHashJoinExec
+import
org.apache.spark.sql.execution.streaming.operators.stateful.join.StreamingSymmetricHashJoinHelper.{JoinStateKeyWatermarkPredicate,
JoinStateValueWatermarkPredicate}
+import org.apache.spark.sql.execution.streaming.runtime.MemoryStream
+import org.apache.spark.sql.execution.streaming.state.RocksDBStateStoreProvider
+import org.apache.spark.sql.functions._
+import org.apache.spark.sql.internal.SQLConf
+
+class StreamingJoinEqualityWatermarkSuite extends StreamTest {
+ import testImplicits._
+
+ for {
+ version <- Seq(2, 3, 4)
+ restart <- Seq(false, true)
+ } {
+ test(s"equality eviction follows the opposite watermark, V$version
restart=$restart") {
+ withSQLConf(
+ SQLConf.STREAMING_JOIN_STATE_FORMAT_VERSION.key -> version.toString,
+ SQLConf.STATE_STORE_PROVIDER_CLASS.key ->
classOf[RocksDBStateStoreProvider].getName,
+ SQLConf.STREAMING_NO_DATA_MICRO_BATCHES_ENABLED.key -> "false") {
+ val leftInput = MemoryStream[(Int, Int)]
+ val rightInput = MemoryStream[(Int, Int)]
+ val left = leftInput.toDF().toDF("a", "b")
+ .select(timestamp_seconds($"a").as("la"),
timestamp_seconds($"b").as("lb"))
+ .withWatermark("la", "10 seconds")
+ val right = rightInput.toDF().toDF("a", "b")
+ .select(timestamp_seconds($"a").as("ra"),
timestamp_seconds($"b").as("rb"))
+ .withWatermark("rb", "10 seconds")
+ val joined = left.join(right, expr("la = ra AND lb = rb"),
"full_outer")
+ .select($"la".cast("int"), $"lb".cast("int"),
+ $"ra".cast("int"), $"rb".cast("int"))
+ withTempDir { checkpoint =>
+ val restartActions = if (restart) {
+ Seq(StopStream, StartStream(checkpointLocation =
checkpoint.getCanonicalPath))
+ } else {
+ Nil
+ }
+ testStream(joined)((Seq(
+ StartStream(checkpointLocation = checkpoint.getCanonicalPath),
+ MultiAddData(leftInput, (5, 50))(rightInput, (80, 50)),
+ CheckNewAnswer(),
+ MultiAddData(leftInput, (60, 100))(rightInput, (70, 50)),
+ CheckNewAnswer(),
+ AddData(leftInput, (70, 100)),
+ // At watermark 40, left (5, 50) can still match fresh right input
on rb=50.
+ CheckNewAnswer()) ++ restartActions ++ Seq(
+ AddData(rightInput, (5, 50)),
+ CheckNewAnswer(Row(5, 50, 5, 50)),
+ // Fresh on la, but already expired on lb: V4 must visit it below
the old cutoff.
+ AddData(leftInput, (90, 10)),
+ CheckNewAnswer(Row(90, 10, null, null)),
+ MultiAddData(leftInput, (200, 200))(rightInput, (200, 200)),
+ CheckNewAnswer(Row(200, 200, 200, 200)),
+ MultiAddData(leftInput, (210, 210))(rightInput, (210, 210)),
+ CheckNewAnswer(Row(210, 210, 210, 210), Row(60, 100, null, null),
+ Row(70, 100, null, null), Row(null, null, 80, 50), Row(null,
null, 70, 50))
+ )): _*)
+ }
+ }
+ }
+ }
+
+ test("V4 window equality retains state for future unwatermarked input") {
+ withSQLConf(
+ SQLConf.STREAMING_JOIN_STATE_FORMAT_VERSION.key -> "4",
+ SQLConf.STATE_STORE_PROVIDER_CLASS.key ->
classOf[RocksDBStateStoreProvider].getName) {
+ val leftInput = MemoryStream[Int]
+ val rightInput = MemoryStream[Int]
+ val left = leftInput.toDF()
+ .select($"value".as("key"), timestamp_seconds($"value").as("time"))
+ .withWatermark("time", "10 seconds")
+ .select($"key", window($"time", "10 seconds"))
+ val right = rightInput.toDF()
+ .select($"value".as("key"), timestamp_seconds($"value").as("time"))
+ .select($"key", window($"time", "10 seconds"))
+ val joined = left.join(right, Seq("key", "window"))
+ .select($"key", $"window.end".cast("long"))
+ testStream(joined)(
+ AddData(leftInput, 1), CheckNewAnswer(),
+ AddData(rightInput, 1), CheckNewAnswer(Row(1, 10L)),
+ AddData(leftInput, 25), CheckNewAnswer(),
+ StopStream, StartStream(),
+ // The right input has no late filter; its old window must still find
left state.
+ AddData(rightInput, 1), CheckNewAnswer(Row(1, 10L)),
+ AddData(leftInput, 5), CheckNewAnswer())
+ }
+ }
+
+ for {
+ version <- Seq(2, 3, 4)
+ offset <- Seq(10, -10)
+ } {
+ test(s"equality on a shifted opposite event time evicts state, V$version
offset=$offset") {
+ withSQLConf(
+ SQLConf.STREAMING_JOIN_STATE_FORMAT_VERSION.key -> version.toString,
+ SQLConf.STATE_STORE_PROVIDER_CLASS.key ->
classOf[RocksDBStateStoreProvider].getName,
+ SQLConf.STREAMING_NO_DATA_MICRO_BATCHES_ENABLED.key -> "false") {
+ val leftInput = MemoryStream[(Int, Int)]
+ val rightInput = MemoryStream[(Int, Int)]
+ val left = leftInput.toDF().toDF("lk", "lt")
+ .select($"lk", timestamp_seconds($"lt").as("lt"))
+ .withWatermark("lt", "10 seconds")
+ val right = rightInput.toDF().toDF("rk", "rt")
+ .select($"rk", timestamp_seconds($"rt").as("rt"))
+ .withWatermark("rt", "10 seconds")
+ // A left row matches the right row whose time is `offset` seconds
earlier.
+ val joined = left.join(right,
+ expr(s"lk = rk AND lt = rt + INTERVAL $offset SECONDS"),
"left_outer")
+ .select($"lk", $"lt".cast("int"), $"rk", $"rt".cast("int"))
+ testStream(joined)(
+ MultiAddData(leftInput, (1, 100 + offset), (2, 90 + offset), (3, 145
+ offset))(
+ rightInput, (9, 50)),
+ CheckNewAnswer(),
+ AddData(rightInput, (1, 100)),
+ CheckNewAnswer(Row(1, 100 + offset, 1, 100)),
+ MultiAddData(leftInput, (9, 300))(rightInput, (9, 150)),
+ // At watermark 90, a future right row can still have time 90.
Review Comment:
**Nit (P3):** No later right row can have time 90: once the watermark
reaches 90, every later batch late-filters right input at 90 or above and drops
`rt <= 90`. Left `(2, 90 + offset)` survives this batch only because
`getStateKeyWatermark` solves `stateKey >= rt + offset` through the
`GreaterThanOrEqual` branch, which subtracts 1 ms. The cutoffs are therefore
`(90 + offset) s - 1 ms` here and `(140 + offset) s - 1 ms` below. As written,
the comments make the 1 ms margin look required for correctness. An exact
cutoff would correctly emit `Row(2, 90 + offset, null, null)` one batch earlier
and fail this test.
**Verification:**
- **Inspection:** The comments give each cutoff as the watermark plus the
offset less 1 ms and no longer claim that a later right row can have time 90.
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/StreamingJoinHelper.scala:
##########
@@ -35,18 +34,130 @@ import org.apache.spark.unsafe.types.CalendarInterval
object StreamingJoinHelper extends PredicateHelper with Logging {
/**
- * Check the provided logical plan to see if its join keys contain a
watermark attribute.
- *
- * Will return false if the plan is not an equijoin.
- * @param plan the logical plan to check
+ * Find the equality key filtered by this input's watermark. Its ordinal can
be used to
+ * evict the opposite input's state, whose equality keys have the same
ordering.
+ * For leftTime = rightTime, a watermark on rightTime bounds leftTime even
when leftTime
+ * has no watermark. It does not bound right-side state without a watermark
on leftTime.
+ * A key computed from the event time by adding a constant interval, such as
Review Comment:
**Nit (P3):** This says any key computed from the event time by adding a
constant interval is bounded, and `getStateKeyWatermark` and
`getEventTimeWatermarkFromKey` describe the shifted cutoff the same way. But
`isIntervalShift` rejects any month part, never matches
`TimestampAddYMInterval`, and accepts whole days only in a fixed-offset session
time zone. So `rightTime + INTERVAL 1 DAY` under America/Los_Angeles and
`rightTime + INTERVAL 1 MONTH` in any zone get no bound, as this PR's own
helper and analysis tests assert. Callers that rely on these docs cannot see
why outer joins on such shifts are rejected.
See **Shared repair plan 1** in the review body.
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/operators/stateful/join/StreamingSymmetricHashJoinHelper.scala:
##########
@@ -224,98 +228,150 @@ object StreamingSymmetricHashJoinHelper extends Logging {
WatermarkSupport.findEventTimeColumn(rightAttributes,
allowMultipleEventTimeColumns = useFirstEventTimeColumn)
- val joinKeyOrdinalForWatermark: Option[Int] =
findJoinKeyOrdinalForWatermark(
- leftKeys, rightKeys)
-
def getOneSideStateWatermarkPredicate(
oneSideInputAttributes: Seq[Attribute],
oneSideJoinKeys: Seq[Expression],
- otherSideInputAttributes: Seq[Attribute]):
Option[JoinStateWatermarkPredicate] = {
- val isWatermarkDefinedOnInput =
oneSideInputAttributes.exists(_.metadata.contains(delayKey))
+ otherSideInputAttributes: Seq[Attribute],
+ otherSideJoinKeys: Seq[Expression]):
Option[JoinStateWatermarkPredicate] = {
+ // State is bounded by future input from the opposite side, not by its
own watermark.
+ val joinKeyOrdinalForWatermark =
StreamingJoinHelper.getStateKeyWatermarkOrdinal(
+ otherSideJoinKeys, otherSideInputAttributes)
val isWatermarkDefinedOnJoinKey = joinKeyOrdinalForWatermark.isDefined
if (isWatermarkDefinedOnJoinKey) { // case 1 and 3 in the
StreamingSymmetricHashJoinExec docs
+ val ordinal = joinKeyOrdinalForWatermark.get
val keyExprWithWatermark = BoundReference(
- joinKeyOrdinalForWatermark.get,
- oneSideJoinKeys(joinKeyOrdinalForWatermark.get).dataType,
- oneSideJoinKeys(joinKeyOrdinalForWatermark.get).nullable)
- val expr = watermarkExpression(Some(keyExprWithWatermark),
eventTimeWatermarkForEviction)
- expr.map { e =>
- // V4 can skip keys at or below the previous watermark only if
late-input filtering
- // rejects new rows in that range on this same key. A watermark on
the other input's
- // equality key can drive eviction even when this input has no
watermark, or has one
- // on a different column. New rows can then pass late-input
filtering with keys
- // already eligible for eviction. V4 must scan from the beginning to
find them;
- // otherwise, outer joins can fail to emit null rows for these
unmatched inputs.
- val prevStateKeyWatermark =
- if (oneSideInputAttributes.find(_.metadata.contains(delayKey))
-
.exists(oneSideJoinKeys(joinKeyOrdinalForWatermark.get).semanticEquals)) {
- eventTimeWatermarkForLateEvents
- } else {
- None
- }
- // watermarkExpression only provides the expression when
eventTimeWatermarkForEviction
- // is defined.
- JoinStateKeyWatermarkPredicate(
- e,
- eventTimeWatermarkForEviction.get,
- prevStateKeyWatermark)
- }
- } else if (isWatermarkDefinedOnInput) { // case 2 in the
StreamingSymmetricHashJoinExec docs
- val stateValueWatermark = StreamingJoinHelper.getStateValueWatermark(
- attributesToFindStateWatermarkFor =
AttributeSet(oneSideInputAttributes),
- attributesWithEventWatermark =
AttributeSet(otherSideInputAttributes),
- condition,
- eventTimeWatermarkForEviction)
- // A row can pass late-input filtering but already be eligible for
eviction in this batch.
- // When the previous join-derived state cutoff is ahead of the
late-input watermark, a new
- // row can fall at or below that cutoff. V4 must scan from the
beginning to find such rows.
- val prevStateValueWatermark = eventTimeWatermarkForLateEvents.flatMap
{ lateWatermark =>
- StreamingJoinHelper.getStateValueWatermark(
- attributesToFindStateWatermarkFor =
AttributeSet(oneSideInputAttributes),
- attributesWithEventWatermark =
AttributeSet(otherSideInputAttributes),
- condition,
- eventTimeWatermarkForLateEvents).filter(_ <= lateWatermark)
+ ordinal, oneSideJoinKeys(ordinal).dataType,
oneSideJoinKeys(ordinal).nullable)
+ // The opposite watermark bounds this key, shifted by any constant in
the opposite key.
+ def keyWatermark(watermark: Option[Long]): Option[Long] =
+ StreamingJoinHelper.getStateKeyWatermark(
+ otherSideJoinKeys, otherSideInputAttributes, ordinal, watermark)
+ keyWatermark(eventTimeWatermarkForEviction).flatMap { stateWatermark =>
+ watermarkExpression(Some(keyExprWithWatermark),
Some(stateWatermark)).map { e =>
+ // V4 can skip keys at or below the previous watermark only if
late-input filtering
+ // rejects new rows in that range on this same key. A watermark on
the other input's
+ // equality key can drive eviction even when this input has no
watermark, or has one
+ // on a different column. New rows can then pass late-input
filtering with keys
+ // already eligible for eviction. V4 must scan from the beginning
to find them;
+ // otherwise, outer joins can fail to emit null rows for these
unmatched inputs.
+ val prevStateKeyWatermark =
+ if (oneSideInputAttributes.find(_.metadata.contains(delayKey))
+ .exists(oneSideJoinKeys(ordinal).semanticEquals)) {
+ // A cutoff shifted above the late-input watermark also needs
a full scan.
+ eventTimeWatermarkForLateEvents.flatMap { lateWatermark =>
+ keyWatermark(Some(lateWatermark)).filter(_ <= lateWatermark)
+ }
+ } else {
+ None
+ }
+ JoinStateKeyWatermarkPredicate(e, stateWatermark,
prevStateKeyWatermark)
+ }
}
- val inputAttributeWithWatermark =
oneSideInputAttributes.find(_.metadata.contains(delayKey))
- val expr = watermarkExpression(inputAttributeWithWatermark,
stateValueWatermark)
- expr.map { e =>
- // watermarkExpression only provides the expression when
eventTimeWatermarkForEviction
- // is defined
- JoinStateValueWatermarkPredicate(e, stateValueWatermark.get,
prevStateValueWatermark)
+ } else { // case 2 in the StreamingSymmetricHashJoinExec docs
+ // Future matches are limited by the opposite watermark. This input
needs no watermark;
+ // its event-time column may also have been pruned from the physical
join.
+ val otherSideEventTime =
otherSideInputAttributes.find(_.metadata.contains(delayKey))
+ getStateValueWatermarkForInput(oneSideInputAttributes,
otherSideInputAttributes,
+ condition, eventTimeWatermarkForEviction).flatMap { case (attribute,
watermark) =>
+ // Late filtering only constrains the input's event-time column. A
different indexed
+ // column can admit values below the previous cutoff and must be
scanned from the start.
+ val prevStateValueWatermark = eventTimeWatermarkForLateEvents.filter
{ _ =>
+ oneSideInputAttributes.find(_.metadata.contains(delayKey))
+ .exists(_.semanticEquals(attribute))
+ }.flatMap { lateWatermark =>
+ // Also scan from the start if the derived cutoff exceeds the
late-input watermark.
+
StreamingJoinHelper.getStateValueWatermark(AttributeSet(Seq(attribute)),
+ AttributeSet(otherSideEventTime.toSeq), condition,
Some(lateWatermark))
+ .filter(_ <= lateWatermark)
+ }
+ watermarkExpression(Some(attribute), Some(watermark)).map { e =>
+ JoinStateValueWatermarkPredicate(e, watermark,
prevStateValueWatermark)
+ }
}
- } else {
- None
}
}
val leftStateWatermarkPredicate =
- getOneSideStateWatermarkPredicate(leftAttributes, leftKeys,
rightAttributes)
+ getOneSideStateWatermarkPredicate(leftAttributes, leftKeys,
rightAttributes, rightKeys)
val rightStateWatermarkPredicate =
- getOneSideStateWatermarkPredicate(rightAttributes, rightKeys,
leftAttributes)
+ getOneSideStateWatermarkPredicate(rightAttributes, rightKeys,
leftAttributes, leftKeys)
JoinStateWatermarkPredicates(leftStateWatermarkPredicate,
rightStateWatermarkPredicate)
}
- private[join] def findJoinKeyOrdinalForWatermark(
+ /** Keep each cutoff attached to the column constrained by the join
condition. */
+ private def getStateValueWatermarkForInput(
+ inputAttributes: Seq[Attribute],
+ otherInputAttributes: Seq[Attribute],
+ condition: Option[Expression],
+ eventWatermark: Option[Long]): Option[(Attribute, Long)] = {
+ val eventTime = inputAttributes.find(_.metadata.contains(delayKey))
+ // Only the first marked column is checked for late input in compatibility
mode.
+ val otherEventTime =
otherInputAttributes.find(_.metadata.contains(delayKey))
+ // First try the watermarked column. If it has no inferable bound, try the
other timestamp
+ // columns in input schema order and use the first with a bound. This
makes the indexed column
+ // deterministic for a fixed input schema and join condition.
+ val candidates = eventTime.toSeq ++ inputAttributes.filter { attribute =>
+ attribute.dataType == TimestampType &&
!eventTime.exists(_.semanticEquals(attribute))
+ }
+ candidates.iterator.flatMap { attribute =>
+ StreamingJoinHelper.getStateValueWatermark(AttributeSet(Seq(attribute)),
+ AttributeSet(otherEventTime.toSeq), condition,
eventWatermark).map(attribute -> _)
+ }.take(1).toSeq.headOption
+ }
+
+ /**
+ * Conservatively prove that older state can use the current watermark
semantics. Without
+ * watermarks there is no affected state. Otherwise each side must have
exactly one event-time
+ * column, and its own event time must be the sole watermarked equality key
at the same ordinal.
+ * This excludes range bounds and retained event times with no eviction
bound. It also excludes
+ * a key computed from the event time by a constant, which older versions
evicted at the
+ * unshifted watermark. V4 additionally requires the selected equality key
timestamp to be
+ * provably non-null, because old V4 indexed null selected key timestamps
and timestamp
+ * eviction does not recheck the key predicate. A non-null window() key
qualifies: its end is
+ * computed from a non-null event time.
+ */
+ private[sql] def isWatermarkCheckpointCompatible(
+ leftAttributes: Seq[Attribute],
+ rightAttributes: Seq[Attribute],
leftKeys: Seq[Expression],
- rightKeys: Seq[Expression]): Option[Int] = {
- // Join keys of both sides generate rows of the same fields, that is, same
sequence of data
- // types. If one side (say left side) has a column (say timestamp) that
has a watermark on it,
- // then it will never consider joining keys that are < state key watermark
(i.e. event time
- // watermark). On the other side (i.e. right side), even if there is no
watermark defined,
- // there has to be an equivalent column (i.e., timestamp). And any right
side data that has the
- // timestamp < watermark will not match will not match with left side
data, as the left side get
- // filtered with the explicitly defined watermark. So, the watermark in
timestamp column in
- // left side keys effectively causes the timestamp on the right side to
have a watermark.
- // We will use the ordinal of the left timestamp in the left keys to find
the corresponding
- // right timestamp in the right keys.
- leftKeys.zipWithIndex.collectFirst {
- case (ne: NamedExpression, index) if ne.metadata.contains(delayKey) =>
index
- } orElse {
- rightKeys.zipWithIndex.collectFirst {
- case (ne: NamedExpression, index) if ne.metadata.contains(delayKey) =>
index
+ rightKeys: Seq[Expression],
+ stateFormatVersion: Int): Boolean = {
+ val leftEventTime = leftAttributes.filter(_.metadata.contains(delayKey))
+ val rightEventTime = rightAttributes.filter(_.metadata.contains(delayKey))
+
+ def watermarkKeyOrdinals(keys: Seq[Expression]): Seq[Int] = {
+ keys.zipWithIndex.collect {
+ case (key: NamedExpression, index) if key.metadata.contains(delayKey)
=> index
}
}
+
+ def selectedKeyTimestampCanBeNull(key: Attribute): Boolean = key.dataType
match {
+ // window() derives the end from a non-null event time, though
TimeWindow declares the
+ // field nullable.
+ case _: StructType if key.metadata.contains(TimeWindow.marker) =>
+ key.nullable
+ case struct: StructType =>
+ key.nullable || struct.fields.lift(1).forall(_.nullable)
+ case _ =>
+ key.nullable
+ }
+
+ val leftOrdinals = watermarkKeyOrdinals(leftKeys)
+ val rightOrdinals = watermarkKeyOrdinals(rightKeys)
+ if (leftEventTime.isEmpty && rightEventTime.isEmpty) {
+ leftOrdinals.isEmpty && rightOrdinals.isEmpty
+ } else if (leftEventTime.size == 1 && rightEventTime.size == 1) {
+ val leftOrdinal = StreamingJoinHelper.getEventTimeKeyOrdinal(leftKeys,
leftAttributes)
+ val rightOrdinal = StreamingJoinHelper.getEventTimeKeyOrdinal(rightKeys,
rightAttributes)
+ val alignedOwnEventTimeKeys = leftOrdinal.isDefined && leftOrdinal ==
rightOrdinal &&
Review Comment:
**Blocking (P1):** This rule accepts a checkpoint written before this change
only when each input's own event time is its only watermarked equality key, at
the same ordinal on both sides. A checkpoint without the new marker reads it as
0, so every other watermarked join fails its first batch after the upgrade with
`STREAMING_JOIN_CHECKPOINT_INCOMPATIBLE`, including joins whose saved state is
still valid. Take the bundled Spark 2.4.0 checkpoint: `rightId = leftId AND
rightTime >= leftTime AND rightTime <= leftTime + INTERVAL 5 SECONDS`, with
watermarks on both inputs. The base branch and this change derive the same
cutoffs (`leftTime <= wm - 5001 ms`, `rightTime <= wm - 1 ms`), the same
previous cutoffs, the same V4 index columns, and the same output watermark. The
base branch restored that checkpoint, in the SPARK-26187 test this diff
deletes. The join code in v4.3.0 is identical to the base branch, so this
covers checkpoints from released versions. Users upgrading such a query mu
st drop valid state and replay input, and replay cannot rebuild results once
the source no longer has that history. Joins whose eviction or output watermark
really changed should stay rejected, as the base branch's SPARK-26154 guard
rejected only the format 1 outer joins its fix affected.
**Recommended change:** Widen isWatermarkCheckpointCompatible so it also
accepts an old checkpoint when no equality key carries watermark metadata, each
input has exactly one event-time column, and for each side this PR derives no
key predicate and the time-constraint solver finds no bound on any of that
side's columns other than its event time, so the base branch's value-eviction
derivation (the solver over all of that side's columns, applied to its
event-time column) and this PR's derivation are the same predicate on the
event-time column at every watermark; when a stateful operator consumes the
join's output watermark, the two output watermarks must also match, and for
state format V4 the event-time columns must be provably non-null, as the
current rule already requires for keys. IncrementalExecution passes whether a
stateful operator sits above the join. The first commit in this stack
(b42068e35be, SPARK-61344) deleted the base branch's SPARK-26187 restore test
when it introdu
ced the check, and its message gives no reason; restore that test, and turn
the Spark 2.4.0 and 3.5.1 rejection tests in the join tests into resume tests.
**Why this works:** Both derivations call the same time-constraint solver:
the base branch took the minimum over every conjunct that bounds any column of
a side and applied it to that side's event time, while this PR takes the
minimum over the conjuncts that bound the event time. When no conjunct bounds
another column of the side, both minimums range over the same conjuncts, so the
eviction predicates, the previous-batch scan starts, the V4 index column, and,
when both sides are bounded on their event times, the output watermark are
identical at every watermark, and the saved state is exactly what the new code
would have written. Comparing the two cutoffs at a single watermark value would
not prove this: a conjunct with a negative watermark term, which a later PR in
the stack rejects, can lie above the event-time cutoff at one watermark and
below it at another.
**Scope:** Extend the restart proof with a derivation comparison for
watermarked joins without watermarked keys, pass the downstream-operator fact
from the restart check, and restore the historical-checkpoint resume tests.
**Compatibility:** Old checkpoints of joins whose eviction or output
watermark changed keep failing before any state is opened, with the same error
and an unchanged checkpoint.
**Risks:** The comparison runs both derivations through today's solver, so
once whole days are counted conservatively it also accepts a join with
whole-day bounds in a daylight-saving zone whose old state the base branch
evicted with 24-hour days; resuming it under the more conservative cutoffs only
keeps more rows, and rows the base branch already evicted stay evicted, as they
would on any base-branch restart.
**Constraints:** Shapes whose eviction or output watermark changed, such as
one-sided watermarks, bounds on another column, shifted keys, and keys that
drove the base branch's shared ordinal, must stay rejected before state is
opened. The comparison must use the physical plan's attributes and condition,
the ones the run will evict with.
**Exclusions:**
- Checkpoints of joins whose derivations differ still need a new checkpoint
and replay, as the migration guide says.
- Joins whose condition also bounds another column of a side stay rejected
even when that bound never undercuts the event-time cutoff, because proving
that needs the sign of every conjunct's watermark term.
**Success:** Restarting the bundled Spark 2.4.0 and 3.5.1 range-join
checkpoints succeeds and returns the expected rows. A Spark 4.3 checkpoint of a
two-sided event-time range join with watermarks on both inputs restarts on this
version. A key-only join with watermarks on both inputs restarts when no
stateful operator follows it and is rejected when one does. Old checkpoints of
joins whose derived predicates changed are still rejected with
STREAMING_JOIN_CHECKPOINT_INCOMPATIBLE, leaving state and commits unchanged.
**Verification:**
- **Regression:** Restarting the bundled Spark 2.4.0 and 3.5.1 checkpoints
of `rightId = leftId AND rightTime >= leftTime AND rightTime <= leftTime +
INTERVAL 5 SECONDS` resumes and produces the rows the base branch produced.
- **Compatibility:** Old checkpoints of one-sided, expiry-bounded,
shifted-key, and numeric-expiry joins are still rejected on the first batch
with state and commits unchanged, for state formats 1 to 4.
- **Behavior:** An old checkpoint of a key-only join with watermarks on both
inputs resumes when no stateful operator follows the join and is rejected when
an aggregation follows it.
- **Compatibility:** An old V4 checkpoint of a two-sided range join whose
event-time columns are nullable is rejected, and one whose event-time columns
are non-null resumes.
- **Compatibility:** An old checkpoint whose condition bounds another column
of a side next to the event-time range, such as an expiry column, stays
rejected, including when that column's cutoff equals the event-time cutoff at
the restart watermark.
--
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]