Skip to content

[SPARK-56402][SS] Apply rangeScan API in stream-stream join format version 4#55267

Open
HeartSaVioR wants to merge 8 commits intoapache:masterfrom
HeartSaVioR:SPARK-56402-on-top-of-SPARK-56369
Open

[SPARK-56402][SS] Apply rangeScan API in stream-stream join format version 4#55267
HeartSaVioR wants to merge 8 commits intoapache:masterfrom
HeartSaVioR:SPARK-56402-on-top-of-SPARK-56369

Conversation

@HeartSaVioR
Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

This PR proposes to apply rangeScan API in stream-stream join format version 4, which will give an improvement of scanning on matching rows for time interval join and eviction.

The main idea for eviction is to perform scanning secondary index from [the end timestamp of previous scan + 1, new end timestamp], which was [None, new end timestamp]. Previously it had to go through tombstones prior batches made in prior evictions (till compaction happens), and with this change we will be able to skip those tombstones.

The idea of time interval join is straightforward - we know the timestamp range of matching rows and we used it to scope it. Previously we scan all timestamps within the key from RocksDB and apply filter. We move the due of filter to RocksDB, to leverage the same effect with the above (skipping tombstones).

Why are the changes needed?

This change will give a hit to RocksDB about the exact range to scan, reducing the chance of reading tombstone a lot.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

New UTs, and existing UTs.

Was this patch authored or co-authored using generative AI tooling?

Generated-by: Claude 4.6 Opus

Use bounded scan ranges in stream-stream join V4 operators to narrow
the iteration scope during eviction and value lookup:

- scanEvictedKeys (TsWithKeyTypeStore): use scanWithMultiValues with
  startKey derived from the previous batch's state watermark and endKey
  from the current eviction threshold. Thread prevBatchStateWatermark
  through JoinStateWatermarkPredicate -> SupportsEvictByTimestamp.
- getValuesInRange (KeyWithTsToValuesStore): use scanWithMultiValues
  for bounded timestamp ranges, falling back to prefixScan for full
  range.

Create default-valued boundary rows to avoid NullPointerException when
the join key schema contains non-nullable fields (e.g. window structs).
@HeartSaVioR
Copy link
Copy Markdown
Contributor Author

Only the last commit is related to this PR. Once #55226 is merged, I'll rebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant