1

I read this doc where it said stream / table join must have same partitions number on both side.
But I have this topics and partitions, and the code still works, no exception thrown.

kafka-topics.sh --bootstrap-server localhost:9092 --create --partitions 5 --replication-factor 1 --topic t-left
kafka-topics.sh --bootstrap-server localhost:9092 --create --partitions 2 --replication-factor 1 --topic t-right --config "cleanup.policy=compact"

So the left (stream) has 5 partitions, and the right (table) has 2 partitions only.

From the documentation, I thought some error will happen in this code. I get Invalid topology when trying to joins stream / stream with different partitions count, so I thought will have same Invalid topology error, which is not.

        var leftStream = builder.stream("t-left");
        var rightTable = builder.table("t-right");

        // join
        var joinStream = rightStream.join(leftTable, this::joiner,
                Joined.with(stringSerde, stringSerde, stringSerde));

        joinStream.to("t-join", Produced.with(stringSerde, stringSerde));

And the join also happened at t-join.

How can this happened?

Timothy
  • 855
  • 1
  • 13
  • 29
  • Please check all of the topics that are created by Kafka Streams. You can update the description with this list. You may find a repartition topic created automatically. In that case, Kafka Streams is creating a repartition topic internally so the join can happen. – xmar Jul 02 '20 at 18:45
  • If there is no key-changing operation, no repartition topic should be created and you should indeed get an error... If you don't get an error, the join result should be incorrect. Can you verify/confirm? – Matthias J. Sax Jul 04 '20 at 20:06

0 Answers0