Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-18791 Stream-Stream Joins
  3. SPARK-22053

Implement stream-stream inner join in Append mode

    XMLWordPrintableJSON

    Details

    • Type: Sub-task
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.0
    • Fix Version/s: 2.3.0
    • Component/s: Structured Streaming
    • Labels:
      None
    • Target Version/s:

      Description

      Stream-stream inner join is traditionally implemented using a two-way symmetric hash join. At a high level, we want to do the following.

      1. For each stream, we maintain the past rows as state in State Store.

      • For each joining key, there can be multiple rows that have been received.
      • So, we have to effectively maintain a key-to-list-of-values multimap as state for each stream.

      2. In each batch, for each input row in each stream

      • Look up the other streams state to see if there are matching rows, and output them if they satisfy the joining condition
      • Add the input row to corresponding stream’s state.
      • If the data has a timestamp/window column with watermark, then we will use that to calculate the threshold for keys that are required to buffered for future matches and drop the rest from the state.

      Cleaning up old unnecessary state rows depends completely on whether watermark has been defined and what are join conditions. We definitely want to support state clean up two types of queries that are likely to be common.

      • Queries to time range conditions - E.g. SELECT * FROM leftTable, rightTable ON leftKey = rightKey AND leftTime > rightTime - INTERVAL 8 MINUTES AND leftTime < rightTime + INTERVAL 1 HOUR
      • Queries with windows as the matching key - E.g. SELECT * FROM leftTable, rightTable ON leftKey = rightKey AND window(leftTime, "1 hour") = window(rightTime, "1 hour") (pseudo-SQL)

        Attachments

          Activity

            People

            • Assignee:
              tdas Tathagata Das
              Reporter:
              tdas Tathagata Das
            • Votes:
              1 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: