简体   繁体   English

Flink 连接键控和非键控流

[英]Flink connect keyed and non keyed streams

What happens if I connect keyed and non keyed streams in Flink?如果我在 Flink 中连接键控流和非键控流会发生什么? For example;例如;

val stream1 = source.keyBy(_.customerId)
val stream2 = source2.map(operation()...)

stream1.connect(stream2).process(processData).addSink(kafkaSink)

The situation here is that I'm trying to apply set of rules (non keyed stream, stream2) to another stream (stream1), I'm normally broadcasting rules stream but the size of the broadcast is getting bigger and bigger.这里的情况是我正在尝试将一组规则(非键控 stream,stream2)应用于另一个 stream(stream1),我通常广播规则 ZF7B44CFAFD5C52223D7498196C8 的大小越来越大。但广播的大小越来越大。 So, I'd just like to learn that what happens if I don't broadcast one of the streams and connect them in terms of parallelism, state etc.?所以,我只想知道如果我不广播其中一个流并按照并行性、state 等方式连接它们会发生什么?

When you connect two streams, they must fall into one of these cases:当您连接两个流时,它们必须属于以下情况之一:

  1. One of the streams is broadcast其中一个流正在广播
  2. Neither stream is keyed stream 都没有键控
  3. Both streams are keyed into the same keyspace两个流都键入相同的键空间

You cannot connect a keyed stream to a non-keyed stream, because the resulting connection won't be key-partitioned.您不能将键控 stream 连接到非键控 stream,因为生成的连接不会进行键分区。

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

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