栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

Flink如何推断Source输出类型?

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
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/582088.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号