相关方法操作可查看:https://ci.apache.org/projects/flink/flink-docs-release-1.6/dev/batch/
笔者实践了两种方法提供参考
- Distinct:返回一个数据集中去重之后的元素。
data.distinct();
- Join:通过创建在其键上相等的所有元素对来连接两个数据集。(注意:连接转换仅适用于等连接。其他连接类型需要使用OuterJoin或CoGroup表示)
result = input1.join(input2)
.where(0) // key of the first input (tuple field 0)
.equalTo(1); // key of the second input (tuple field 1)