Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Pay attention, that both streams are use as examples for KStream (ie, record stream) and KTable (ie, changelog stream) with different semantics. For KTable, so-called tombstone records with format key:null are of special interest, as they delete a key (those records are shown as null in all examples to highlight tombstone semantics). Last but not least, in Kafka Streams each join is "customized" by the user with a ValueJoiner function that compute the actual result. Hence, we show output records as "X - Y" with X and Y being the left and right value, respectively, given to the value joiner. If the output is shown as null (ie, tombstone message), ValueJoiner will not be called because a result record will be deleted.

...

Improved Left/Outer Stream-Stream Join (v3.0.x and newer)
Anchor
spurious
spurious

Warning

Prior to version 3.0.x Kafka Streams might emit so called "spurious" left/outer join result. In this section we only explain the different new behavior that avoids spurious left/outer stream-stream join results. See New Join Semantics below that describe all joins in more details, including spurious left/output join behavior in versions 0.10.2.x  to 2.8.x

...

ts

STREAM_1 (left)

STREAM_2 (right)

leftJoin

outerJoin

1

null




2


null



3

A




4


a

A - a

A - a

5

B


B - a

B - a

6


b

A - b

B - b

A - b

B - b

7

null




8


null



9

C


C - a

C - b

C - a

C - b

10


c

A - c

B - c

C - c

A - c

B - c

C - c

11


null



12

null




13


null



14


d

B - d

C - d

B - d

C - d

15

D


D - b

D - c

D - d

D - b

D - c

D - d

...



30E


...



45F
E - nullE - null
...



60
fF - nullF - null
...



75G

null - f

...

New Join Semantics (v0.10.2.x and newer)
Anchor
newJoinSemantics
newJoinSemantics

Warning

This section describes the new join semantics as of version 0.10.2.x. For old join semantics (version 0.10.0.x and 0.10.1.x) see Old Join Semantics below.

...

ts
LHS-Stream
(K, extracted-FK)
RHS-Stream State (FK,V)Inner-Join OutputLeft-Join Output
1Publish event to LHS(k,1)(1,foo)(k,1,foo)(k,1,foo)
2Change LHS fk(k,2)(1,foo)(k,null)(k,2,null)
3Change LHS fk(k,3)(1,foo)(k,null)(k,3,null)
4Publish RHS entity-

(1,foo)
(3,bar)

(k,3,bar)(k,3,bar)
5Delete k(k,null)

(1,foo)
(3,bar)

(k,null)(k,null,null)
6Publish original event again(k,1)

(1,foo)
(3,bar)

(k,1,foo)(k,1,foo)
7Publish event to LHS(q,10)

(1,foo)
(3,bar)

-(q,null,10)
8Publish RHS entity-

(1,foo)
(3,bar)
(q,baz)

(q,10,baz)(q,10,baz)

...

...


Old Join Semantics (v0.10.1.x and older)
Anchor
oldJoinSemantics
oldJoinSemantics

Kafka Streams 0.10.1.x (and older) offers the follow join operators:

...