HeartSaVioR commented on code in PR #60665:
URL: https://github.com/apache/spark/pull/60665#discussion_r4621882352
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/operators/stateful/join/SymmetricHashJoinStateManager.scala:
##########
@@ -293,10 +293,14 @@ class SymmetricHashJoinStateManagerV4(
}
}
+ // A NULL event-time key is read as time 0, as a NULL timestamp key always
was, so the first
+ // eviction that covers time 0 removes the row.
private val extractEventTimeFnFromKey: UnsafeRow => Option[Long] = { row =>
joinKeyOrdinalForWatermark.map { idx =>
val attr = keyAttributes(idx)
- if (attr.dataType.isInstanceOf[StructType]) {
+ if (row.isNullAt(idx)) {
+ 0L
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. I ran your example on V2, V3 and V4, with a window key and with a
timestamp key, for left and full outer joins. A NULL-key row that arrives after
the first micro-batch is never output on any of them, and master V2, V3 and V4
(timestamp key) give the same rows and state counts. Only master V4 with a
window key differs: it fails with the NPE. So this PR does not cause the gap;
it only lets V4 window keys reach it. I filed it with the reproducer as
[SPARK-62046](https://issues.apache.org/jira/browse/SPARK-62046) and keep this
PR to the NPE fix. The test comment now points at
[SPARK-62046](https://issues.apache.org/jira/browse/SPARK-62046).
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/operators/stateful/join/SymmetricHashJoinStateManager.scala:
##########
@@ -293,10 +293,14 @@ class SymmetricHashJoinStateManagerV4(
}
}
+ // A NULL event-time key is read as time 0, as a NULL timestamp key always
was, so the first
+ // eviction that covers time 0 removes the row.
private val extractEventTimeFnFromKey: UnsafeRow => Option[Long] = { row =>
joinKeyOrdinalForWatermark.map { idx =>
val attr = keyAttributes(idx)
- if (attr.dataType.isInstanceOf[StructType]) {
+ if (row.isNullAt(idx)) {
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. I ran it: the full outer join outputs `[7,null,7,null]` on V2, V3
and V4, and master V2, V3 and V4 (timestamp key) give the same row. Master V4
with a window key fails with the NPE instead. So this is the existing
[SPARK-61382](https://issues.apache.org/jira/browse/SPARK-61382) (NULL keys of
both inputs match in a full outer join), which this PR now exposes for V4
window keys too. I added this case, with the reproducer, to
[SPARK-61382](https://issues.apache.org/jira/browse/SPARK-61382) rather than
fix it here.
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/operators/stateful/join/SymmetricHashJoinStateManager.scala:
##########
@@ -293,8 +293,9 @@ class SymmetricHashJoinStateManagerV4(
}
}
+ // A NULL event-time key has no event time.
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.
Done: `extractEventTimeFn` now has a TODO naming
[SPARK-62022](https://issues.apache.org/jira/browse/SPARK-62022).
--
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]