简体   繁体   English

KSQL-加入不相等的分区流

[英]KSQL - Join unequal partitions streams

How to join unequal number of partition holding streams in KSQL apart from increase the partition ? 除了增加分区,如何在KSQL中加入不相等数量的分区保存流?

Example Stream-1 is having the 3 partitions and Stream-2 is having the 2 partitions . 示例Stream-1具有3个分区,Stream-2具有2个分区。 In that case , of course we can increase the number partitions for Stream-1 as 3 join . 在这种情况下,我们当然可以将Stream-1的分区数增加为3 join。 But I want to know , any other method to join unequal partitioned streams through KSQL ? 但是我想知道,还有其他方法可以通过KSQL加入不相等的分区流吗?

No, unfortunately KStream/KSQL doesn't support join for unequal partitioned topics. 不,不幸的是,KStream / KSQL不支持不平等分区主题的联接。

It's a pre-requisite that both topics should have same number of partitions before calling join operation otherwise it will fail. 前提条件是,在调用连接操作之前,两个主题均应具有相同数量的分区,否则它将失败。

You can read more about Co-partitioning requirement here: https://docs.confluent.io/current/ksql/docs/developer-guide/partition-data.html#partition-data-to-enable-joins 您可以在此处阅读有关共分区要求的更多信息: https : //docs.confluent.io/current/ksql/docs/developer-guide/partition-data.html#partition-data-to-enable-joins

To ensure co-partitioning, you can use PARTITION_BY clause to create new stream : 为了确保共分区,可以使用PARTITION_BY子句创建新的流:

CREATE STREAM topic_rekeyed WITH (PARTITIONS=6) AS SELECT * FROM topic PARTITION BY topic_key;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM