spark-test commented on code in PR #60701:
URL: https://github.com/apache/spark/pull/60701#discussion_r4639241004
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/operators/stateful/join/SymmetricHashJoinStateManager.scala:
##########
@@ -277,7 +277,10 @@ class SymmetricHashJoinStateManagerV4(
case Some(idx) =>
val attr = inputValueAttributes(idx)
- if (attr.dataType.isInstanceOf[StructType]) {
+ // A NULL event time is read as time 0, as a NULL timestamp always was.
+ if (row.isNullAt(idx)) {
+ 0L
Review Comment:
Thanks for reproducing this and for the two comparison runs. We agree that
the eviction column causes those losses in this query shape: on master, V4
already evicts a NULL timestamp this way, and V2 to V4 all evict non-NULL
windows that can still match, which SPARK-61988 (#60667) addresses. The
NULL-window case still differs on master, though: there V4 fails with the
NullPointerException as soon as it stores such a row, so the query fails
visibly. With this PR alone, the same query keeps running and silently drops
the later match, or in an outer join emits the row null-extended early, and
SPARK-61988 is not merged yet. So this PR on its own turns a loud failure into
missing output, and we are keeping it as a non-blocking finding. Filing
NULL-window rows under a reserved timestamp such as Long.MaxValue, with no
time-index entry, so that no eviction scan reaches them, would avoid it in this
PR and match V2 and V3, which never evict them. If SPARK-61988 lands first and,
as you descri
be, evicts these rows by the bounded column instead, that would resolve it as
well.
<!-- SPARK_DEV_REVIEW_REPLY
{"feedback_id":"inline:4625929478","thread_id":"inline:4625929478","verdict_sha256":"13fa89d6368cb39db22a2a1bcd9a84d513f9c9bdbbc0246e5e088e4e6b586ea6"}
-->
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/operators/stateful/join/SymmetricHashJoinStateManager.scala:
##########
@@ -277,7 +277,10 @@ class SymmetricHashJoinStateManagerV4(
case Some(idx) =>
val attr = inputValueAttributes(idx)
- if (attr.dataType.isInstanceOf[StructType]) {
+ // A NULL event time is read as time 0, as a NULL timestamp always was.
+ if (row.isNullAt(idx)) {
Review Comment:
**Nit (P3):** The guard here covers only the value side.
`extractEventTimeFnFromKey` (lines 299-308 of this file) still reads a
window-struct join key with `row.getStruct(idx, 2).getLong(1)`, so, by our
reading of the code, a NULL watermarked window join key on V4, for example on
the preserved side of a left outer join, still throws the same
`NullPointerException`. Leaving that case to SPARK-61986 (#60704), as your
reply on the join-key thread describes, is fine, but only that reply records
it: a reader of the extractor sees the same unguarded read next to this guarded
one, with nothing saying the gap is known and owned by another change. A TODO
at the extractor would mark it, for example:
```scala
// TODO(SPARK-61986): A NULL window struct join key still throws a
NullPointerException
// here; SPARK-61986 keeps rows whose watermarked join key is NULL out
of the state.
private val extractEventTimeFnFromKey: UnsafeRow => Option[Long] = { row =>
```
This extends existing discussions
[1](https://github.com/apache/spark/pull/60701#issuecomment-7031126970),
[2](https://github.com/apache/spark/pull/60701#discussion_r4625929486).
**Verification:**
- **Inspection:** The key-side event-time extractor in the V4 state manager
carries a TODO that names SPARK-61986 and says a NULL window join key is left
to it, and no code in that extractor changes.
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/operators/stateful/join/SymmetricHashJoinStateManager.scala:
##########
@@ -277,7 +277,10 @@ class SymmetricHashJoinStateManagerV4(
case Some(idx) =>
val attr = inputValueAttributes(idx)
- if (attr.dataType.isInstanceOf[StructType]) {
+ // A NULL event time is read as time 0, as a NULL timestamp always was.
+ if (row.isNullAt(idx)) {
Review Comment:
Thanks, that works for us: with SPARK-61986 (#60704) keeping rows whose
watermarked join key is NULL out of the state, as you describe, leaving the
join-key case to that PR is fine, and we no longer ask to extend the NULL check
here. This review raises one small follow-up: marking that deferral in the code
at the join-key extractor.
<!-- SPARK_DEV_REVIEW_REPLY
{"feedback_id":"inline:4625929486","thread_id":"inline:4625929486","verdict_sha256":"13fa89d6368cb39db22a2a1bcd9a84d513f9c9bdbbc0246e5e088e4e6b586ea6"}
-->
--
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]