我有两种数据类型。
type1 and type2
我有一个 type1
.
DataStream<type1> stream1 =...
内部 stream1
我想创建 type2
我想收集这两样东西 type1
以及 type2
.
一个数据流可以有一个输入类型和两个输出类型吗?或者可以创建一个新的数据流( DataStream<type2> stream2
)内部 stream1
?
或者有没有其他方法可以从一种类型收集两种不同类型的数据?
我有两种数据类型。
type1 and type2
我有一个 type1
.
DataStream<type1> stream1 =...
内部 stream1
我想创建 type2
我想收集这两样东西 type1
以及 type2
.
一个数据流可以有一个输入类型和两个输出类型吗?或者可以创建一个新的数据流( DataStream<type2> stream2
)内部 stream1
?
或者有没有其他方法可以从一种类型收集两种不同类型的数据?
2条答案
按热度按时间yduiuuwa1#
tsm1rwdh2#
您需要先创建一个 Package 器类型,然后拆分并选择流。对于 Package 器,只有一个成员不为null;
拆分并选择:
因为
filter()
以及map()
将被锁在stream1
两者都在同一个线程上执行,而且操作成本很低。