Flink如何推断Source输出类型?

Flink如何推断Source输出类型?,第1张

Flink如何推断Source输出类型

以前写Flink程序的时候,总是好奇它是怎么通过泛型把类型传出去的,今天就来好好看看。
Flink代码
public class SocketWindowWordCount {

public static void main(String[] args) throws Exception {
    // get the execution environment
    final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

    // get input data by connecting to the socket
    DataStream text = env.socketTextStream("localhost", "9999", "n");

    // parse the data, group it, window it, and aggregate the counts
    DataStream windowCounts =
            text.flatMap(
                            new FlatMapFunction() {
                                @Override
                                public void flatMap(
                                        String value, Collector out) {
                                    for (String word : value.split("\s

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/5573301.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-12-14
下一篇2022-12-14

发表评论

登录后才能评论

评论列表(0条)

    保存