双流JOIN的源代码解读

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

双流JOIN的源代码解读

xuefli@outlook.com
DataStream 双流join时,看代码是使用CoGroupedStream的TaggedUnion,把T1,T2变成TaggedUnion统一对象后,union流后处理的,但是未找到如何处理UnionKeySelector<T1, T2, KEY> unionKeySelector,即对T1.key.equals(T2.key)进行处理的代码在哪里,这个有人知道吗

```

UnionTypeInfo<T1, T2> unionType = new UnionTypeInfo<>(input1.getType(), input2.getType());
UnionKeySelector<T1, T2, KEY> unionKeySelector = new UnionKeySelector<>(keySelector1, keySelector2);

DataStream<TaggedUnion<T1, T2>> taggedInput1 = input1
      .map(new Input1Tagger<T1, T2>())
      .setParallelism(input1.getParallelism())
      .returns(unionType);
DataStream<TaggedUnion<T1, T2>> taggedInput2 = input2
      .map(new Input2Tagger<T1, T2>())
      .setParallelism(input2.getParallelism())
      .returns(unionType);

DataStream<TaggedUnion<T1, T2>> unionStream = taggedInput1.union(taggedInput2);

// we explicitly create the keyed stream to manually pass the key type information in
windowedStream =
      new KeyedStream<TaggedUnion<T1, T2>, KEY>(unionStream, unionKeySelector, keyType)
      .window(windowAssigner);

//在源代码中什么地方处理T1.key.equals(T2.key)的
```


发送自 Windows 10 版邮件<https://go.microsoft.com/fwlink/?LinkId=550986>应用