Flink 基本转换算子传参方式的总结

Transformation

数据源读入数据之后,我们就可以使用各种转换算子,将一个或多个DataStream转换为新的DataStream,如上图所示。一个Flink程序的核心,其实就是所有的转换操作,它们决定了处理的业务逻辑。我们可以针对一条流进行转换处理,也可以进行分流、合流等多流转换操作,从而组合成复杂的数据流拓扑。但是我们在使用诸如 map,flatMap,filter 时都需要传入一个参数,今天我们就对基本算子的参数得出形式做一下总结。

function

算子的参数其实是调用函数时的执行逻辑,但是这个执行逻辑的表现形式有所不同,下面我们就拿 map 算子作为例子来看下参数传递的几个形式

需求:传入一个POJO 有三个属性(用户名,url,timestamp),这里需要通过map 算子进行转换,将用户名进行返回。

数据准备

首先获取 flink上下文执行环境,并读取要转换的数据

  StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.setParallelism(1);
        //从元素中读取数据
        DataStreamSource<Event> elementStream =
                //直接构建对象进行读取数据
                env.fromElements(new Event("令狐冲", "./cart", 1000L),
                        new Event("任盈盈", "./pro?id101", 3000L),
                        new Event("依琳", "./home", 2000L));

方式一、实现 MapFunction

这里构建一个类实现 MapFunction 形式来处理

    public static class MyMapper implements MapFunction<Event, String> {

        @Override
        public String map(Event value) throws Exception {
            return value.user;
        }
    }

调用静态类实现需求‘

        //提取用户 使用自定义类 实现 MapFunction
        SingleOutputStreamOperator<String> map1 = elementStream.map(new MyMapper());

结果

E:\Tools\work_tools\jdk1.8\bin\java.exe "-javaagent:D:\tool\IntelliJ IDEA 2020.1\lib\idea_rt.jar=50865:D:\tool\IntelliJ IDEA 2020.1\bin" -Dfile.encoding=UTF-8 -classpath E:\Tools\work_tools\jdk1.8\jre\lib\charsets.jar;E:\Tools\work_tools\jdk1.8\jre\lib\deploy.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\access-bridge-64.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\cldrdata.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\dnsns.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\jaccess.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\jfxrt.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\localedata.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\nashorn.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\sunec.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\sunjce_provider.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\sunmscapi.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\sunpkcs11.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\zipfs.jar;E:\Tools\work_tools\jdk1.8\jre\lib\javaws.jar;E:\Tools\work_tools\jdk1.8\jre\lib\jce.jar;E:\Tools\work_tools\jdk1.8\jre\lib\jfr.jar;E:\Tools\work_tools\jdk1.8\jre\lib\jfxswt.jar;E:\Tools\work_tools\jdk1.8\jre\lib\jsse.jar;E:\Tools\work_tools\jdk1.8\jre\lib\management-agent.jar;E:\Tools\work_tools\jdk1.8\jre\lib\plugin.jar;E:\Tools\work_tools\jdk1.8\jre\lib\resources.jar;E:\Tools\work_tools\jdk1.8\jre\lib\rt.jar;E:\workspace_idea\flink01\target\classes;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-java\1.13.0\flink-java-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-core\1.13.0\flink-core-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-annotations\1.13.0\flink-annotations-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-metrics-core\1.13.0\flink-metrics-core-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-shaded-asm-7\7.1-13.0\flink-shaded-asm-7-7.1-13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\esotericsoftware\kryo\kryo\2.24.0\kryo-2.24.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\esotericsoftware\minlog\minlog\1.2\minlog-1.2.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\objenesis\objenesis\2.1\objenesis-2.1.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\commons\commons-compress\1.20\commons-compress-1.20.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\commons\commons-lang3\3.3.2\commons-lang3-3.3.2.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\commons\commons-math3\3.5\commons-math3-3.5.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\google\code\findbugs\jsr305\1.3.9\jsr305-1.3.9.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\force-shading\1.13.0\force-shading-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-streaming-java_2.12\1.13.0\flink-streaming-java_2.12-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-file-sink-common\1.13.0\flink-file-sink-common-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-runtime_2.12\1.13.0\flink-runtime_2.12-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-queryable-state-client-java\1.13.0\flink-queryable-state-client-java-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-hadoop-fs\1.13.0\flink-hadoop-fs-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-io\commons-io\2.7\commons-io-2.7.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-shaded-netty\4.1.49.Final-13.0\flink-shaded-netty-4.1.49.Final-13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-shaded-jackson\2.12.1-13.0\flink-shaded-jackson-2.12.1-13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-shaded-zookeeper-3\3.4.14-13.0\flink-shaded-zookeeper-3-3.4.14-13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\javassist\javassist\3.24.0-GA\javassist-3.24.0-GA.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\scala-lang\scala-library\2.12.7\scala-library-2.12.7.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\typesafe\akka\akka-actor_2.12\2.5.21\akka-actor_2.12-2.5.21.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\typesafe\config\1.3.3\config-1.3.3.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\scala-lang\modules\scala-java8-compat_2.12\0.8.0\scala-java8-compat_2.12-0.8.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\typesafe\akka\akka-stream_2.12\2.5.21\akka-stream_2.12-2.5.21.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\reactivestreams\reactive-streams\1.0.2\reactive-streams-1.0.2.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\typesafe\ssl-config-core_2.12\0.3.7\ssl-config-core_2.12-0.3.7.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\scala-lang\modules\scala-parser-combinators_2.12\1.1.1\scala-parser-combinators_2.12-1.1.1.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\typesafe\akka\akka-protobuf_2.12\2.5.21\akka-protobuf_2.12-2.5.21.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\typesafe\akka\akka-slf4j_2.12\2.5.21\akka-slf4j_2.12-2.5.21.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\clapper\grizzled-slf4j_2.12\1.3.2\grizzled-slf4j_2.12-1.3.2.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\github\scopt\scopt_2.12\3.5.0\scopt_2.12-3.5.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\xerial\snappy\snappy-java\1.1.8.3\snappy-java-1.1.8.3.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\twitter\chill_2.12\0.7.6\chill_2.12-0.7.6.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\twitter\chill-java\0.7.6\chill-java-0.7.6.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\lz4\lz4-java\1.6.0\lz4-java-1.6.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-shaded-guava\18.0-13.0\flink-shaded-guava-18.0-13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-clients_2.12\1.13.0\flink-clients_2.12-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-optimizer_2.12\1.13.0\flink-optimizer_2.12-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-cli\commons-cli\1.3.1\commons-cli-1.3.1.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-connector-kafka_2.12\1.13.0\flink-connector-kafka_2.12-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\kafka\kafka-clients\2.4.1\kafka-clients-2.4.1.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\github\luben\zstd-jni\1.4.3-1\zstd-jni-1.4.3-1.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-connector-base\1.13.0\flink-connector-base-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\slf4j\slf4j-api\1.7.30\slf4j-api-1.7.30.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\slf4j\slf4j-log4j12\1.7.30\slf4j-log4j12-1.7.30.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\log4j\log4j\1.2.17\log4j-1.2.17.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\logging\log4j\log4j-to-slf4j\2.14.0\log4j-to-slf4j-2.14.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\logging\log4j\log4j-api\2.14.0\log4j-api-2.14.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\xmlenc\xmlenc\0.52\xmlenc-0.52.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-codec\commons-codec\1.4\commons-codec-1.4.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-net\commons-net\3.1\commons-net-3.1.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-logging\commons-logging\1.1.3\commons-logging-1.1.3.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-lang\commons-lang\2.6\commons-lang-2.6.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-configuration\commons-configuration\1.6\commons-configuration-1.6.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-digester\commons-digester\1.8\commons-digester-1.8.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-beanutils\commons-beanutils\1.7.0\commons-beanutils-1.7.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-beanutils\commons-beanutils-core\1.8.0\commons-beanutils-core-1.8.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\codehaus\jackson\jackson-core-asl\1.9.13\jackson-core-asl-1.9.13.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\codehaus\jackson\jackson-mapper-asl\1.9.13\jackson-mapper-asl-1.9.13.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\avro\avro\1.7.4\avro-1.7.4.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\thoughtworks\paranamer\paranamer\2.3\paranamer-2.3.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\google\protobuf\protobuf-java\2.5.0\protobuf-java-2.5.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\zookeeper\zookeeper\3.4.6\zookeeper-3.4.6.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\mortbay\jetty\jetty-util\6.1.26\jetty-util-6.1.26.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\io\netty\netty\3.6.2.Final\netty-3.6.2.Final.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\io\netty\netty-all\4.0.23.Final\netty-all-4.0.23.Final.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\javax\xml\bind\jaxb-api\2.2.2\jaxb-api-2.2.2.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\javax\xml\stream\stax-api\1.0-2\stax-api-1.0-2.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\javax\activation\activation\1.1\activation-1.1.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\javax\servlet\servlet-api\2.5\servlet-api-2.5.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\sun\jersey\jersey-core\1.9\jersey-core-1.9.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-connector-kafka_2.11\1.13.0\flink-connector-kafka_2.11-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\bahir\flink-connector-redis_2.11\1.0\flink-connector-redis_2.11-1.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-streaming-java_2.11\1.2.0\flink-streaming-java_2.11-1.2.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-runtime_2.11\1.2.0\flink-runtime_2.11-1.2.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-shaded-hadoop2\1.2.0\flink-shaded-hadoop2-1.2.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\tukaani\xz\1.0\xz-1.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-el\commons-el\1.0\commons-el-1.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\jamesmurty\utils\java-xmlbuilder\0.4\java-xmlbuilder-0.4.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\jcraft\jsch\0.1.42\jsch-0.1.42.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-beanutils\commons-beanutils-bean-collections\1.8.3\commons-beanutils-bean-collections-1.8.3.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-daemon\commons-daemon\1.0.13\commons-daemon-1.0.13.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\data-artisans\flakka-actor_2.11\2.3-custom\flakka-actor_2.11-2.3-custom.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\data-artisans\flakka-remote_2.11\2.3-custom\flakka-remote_2.11-2.3-custom.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\uncommons\maths\uncommons-maths\1.2.2a\uncommons-maths-1.2.2a.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\data-artisans\flakka-slf4j_2.11\2.3-custom\flakka-slf4j_2.11-2.3-custom.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\clapper\grizzled-slf4j_2.11\1.0.2\grizzled-slf4j_2.11-1.0.2.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\github\scopt\scopt_2.11\3.2.0\scopt_2.11-3.2.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\fasterxml\jackson\core\jackson-core\2.7.4\jackson-core-2.7.4.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\fasterxml\jackson\core\jackson-databind\2.7.4\jackson-databind-2.7.4.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\fasterxml\jackson\core\jackson-annotations\2.7.0\jackson-annotations-2.7.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\twitter\chill_2.11\0.7.4\chill_2.11-0.7.4.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-clients_2.11\1.2.0\flink-clients_2.11-1.2.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-optimizer_2.11\1.2.0\flink-optimizer_2.11-1.2.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\sling\org.apache.sling.commons.json\2.0.6\org.apache.sling.commons.json-2.0.6.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\redis\clients\jedis\2.8.0\jedis-2.8.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\commons\commons-pool2\2.3\commons-pool2-2.3.jar org.wdh01.chapter05.TransformMapTest
实现MapFunction 接口> 令狐冲
实现MapFunction 接口> 任盈盈
实现MapFunction 接口> 依琳

方式二、直接使用匿名内部类实现 MapFunction 形式

这种方式和上一个形式一样吗,只是省去了单独定义一个类,.

        //提取用户 使用匿名类实现 MapFunction
        SingleOutputStreamOperator<String> map2 = elementStream.map(new MapFunction<Event, String>() {
            @Override
            public String map(Event value) throws Exception {
                return value.user;
            }
        });
 map2.print("MapFunction 内部类");

结果

E:\Tools\work_tools\jdk1.8\bin\java.exe "-javaagent:D:\tool\IntelliJ IDEA 2020.1\lib\idea_rt.jar=50988:D:\tool\IntelliJ IDEA 2020.1\bin" -Dfile.encoding=UTF-8 -classpath E:\Tools\work_tools\jdk1.8\jre\lib\charsets.jar;E:\Tools\work_tools\jdk1.8\jre\lib\deploy.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\access-bridge-64.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\cldrdata.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\dnsns.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\jaccess.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\jfxrt.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\localedata.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\nashorn.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\sunec.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\sunjce_provider.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\sunmscapi.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\sunpkcs11.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\zipfs.jar;E:\Tools\work_tools\jdk1.8\jre\lib\javaws.jar;E:\Tools\work_tools\jdk1.8\jre\lib\jce.jar;E:\Tools\work_tools\jdk1.8\jre\lib\jfr.jar;E:\Tools\work_tools\jdk1.8\jre\lib\jfxswt.jar;E:\Tools\work_tools\jdk1.8\jre\lib\jsse.jar;E:\Tools\work_tools\jdk1.8\jre\lib\management-agent.jar;E:\Tools\work_tools\jdk1.8\jre\lib\plugin.jar;E:\Tools\work_tools\jdk1.8\jre\lib\resources.jar;E:\Tools\work_tools\jdk1.8\jre\lib\rt.jar;E:\workspace_idea\flink01\target\classes;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-java\1.13.0\flink-java-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-core\1.13.0\flink-core-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-annotations\1.13.0\flink-annotations-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-metrics-core\1.13.0\flink-metrics-core-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-shaded-asm-7\7.1-13.0\flink-shaded-asm-7-7.1-13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\esotericsoftware\kryo\kryo\2.24.0\kryo-2.24.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\esotericsoftware\minlog\minlog\1.2\minlog-1.2.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\objenesis\objenesis\2.1\objenesis-2.1.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\commons\commons-compress\1.20\commons-compress-1.20.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\commons\commons-lang3\3.3.2\commons-lang3-3.3.2.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\commons\commons-math3\3.5\commons-math3-3.5.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\google\code\findbugs\jsr305\1.3.9\jsr305-1.3.9.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\force-shading\1.13.0\force-shading-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-streaming-java_2.12\1.13.0\flink-streaming-java_2.12-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-file-sink-common\1.13.0\flink-file-sink-common-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-runtime_2.12\1.13.0\flink-runtime_2.12-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-queryable-state-client-java\1.13.0\flink-queryable-state-client-java-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-hadoop-fs\1.13.0\flink-hadoop-fs-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-io\commons-io\2.7\commons-io-2.7.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-shaded-netty\4.1.49.Final-13.0\flink-shaded-netty-4.1.49.Final-13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-shaded-jackson\2.12.1-13.0\flink-shaded-jackson-2.12.1-13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-shaded-zookeeper-3\3.4.14-13.0\flink-shaded-zookeeper-3-3.4.14-13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\javassist\javassist\3.24.0-GA\javassist-3.24.0-GA.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\scala-lang\scala-library\2.12.7\scala-library-2.12.7.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\typesafe\akka\akka-actor_2.12\2.5.21\akka-actor_2.12-2.5.21.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\typesafe\config\1.3.3\config-1.3.3.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\scala-lang\modules\scala-java8-compat_2.12\0.8.0\scala-java8-compat_2.12-0.8.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\typesafe\akka\akka-stream_2.12\2.5.21\akka-stream_2.12-2.5.21.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\reactivestreams\reactive-streams\1.0.2\reactive-streams-1.0.2.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\typesafe\ssl-config-core_2.12\0.3.7\ssl-config-core_2.12-0.3.7.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\scala-lang\modules\scala-parser-combinators_2.12\1.1.1\scala-parser-combinators_2.12-1.1.1.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\typesafe\akka\akka-protobuf_2.12\2.5.21\akka-protobuf_2.12-2.5.21.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\typesafe\akka\akka-slf4j_2.12\2.5.21\akka-slf4j_2.12-2.5.21.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\clapper\grizzled-slf4j_2.12\1.3.2\grizzled-slf4j_2.12-1.3.2.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\github\scopt\scopt_2.12\3.5.0\scopt_2.12-3.5.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\xerial\snappy\snappy-java\1.1.8.3\snappy-java-1.1.8.3.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\twitter\chill_2.12\0.7.6\chill_2.12-0.7.6.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\twitter\chill-java\0.7.6\chill-java-0.7.6.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\lz4\lz4-java\1.6.0\lz4-java-1.6.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-shaded-guava\18.0-13.0\flink-shaded-guava-18.0-13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-clients_2.12\1.13.0\flink-clients_2.12-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-optimizer_2.12\1.13.0\flink-optimizer_2.12-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-cli\commons-cli\1.3.1\commons-cli-1.3.1.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-connector-kafka_2.12\1.13.0\flink-connector-kafka_2.12-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\kafka\kafka-clients\2.4.1\kafka-clients-2.4.1.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\github\luben\zstd-jni\1.4.3-1\zstd-jni-1.4.3-1.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-connector-base\1.13.0\flink-connector-base-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\slf4j\slf4j-api\1.7.30\slf4j-api-1.7.30.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\slf4j\slf4j-log4j12\1.7.30\slf4j-log4j12-1.7.30.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\log4j\log4j\1.2.17\log4j-1.2.17.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\logging\log4j\log4j-to-slf4j\2.14.0\log4j-to-slf4j-2.14.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\logging\log4j\log4j-api\2.14.0\log4j-api-2.14.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\xmlenc\xmlenc\0.52\xmlenc-0.52.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-codec\commons-codec\1.4\commons-codec-1.4.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-net\commons-net\3.1\commons-net-3.1.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-logging\commons-logging\1.1.3\commons-logging-1.1.3.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-lang\commons-lang\2.6\commons-lang-2.6.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-configuration\commons-configuration\1.6\commons-configuration-1.6.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-digester\commons-digester\1.8\commons-digester-1.8.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-beanutils\commons-beanutils\1.7.0\commons-beanutils-1.7.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-beanutils\commons-beanutils-core\1.8.0\commons-beanutils-core-1.8.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\codehaus\jackson\jackson-core-asl\1.9.13\jackson-core-asl-1.9.13.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\codehaus\jackson\jackson-mapper-asl\1.9.13\jackson-mapper-asl-1.9.13.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\avro\avro\1.7.4\avro-1.7.4.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\thoughtworks\paranamer\paranamer\2.3\paranamer-2.3.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\google\protobuf\protobuf-java\2.5.0\protobuf-java-2.5.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\zookeeper\zookeeper\3.4.6\zookeeper-3.4.6.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\mortbay\jetty\jetty-util\6.1.26\jetty-util-6.1.26.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\io\netty\netty\3.6.2.Final\netty-3.6.2.Final.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\io\netty\netty-all\4.0.23.Final\netty-all-4.0.23.Final.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\javax\xml\bind\jaxb-api\2.2.2\jaxb-api-2.2.2.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\javax\xml\stream\stax-api\1.0-2\stax-api-1.0-2.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\javax\activation\activation\1.1\activation-1.1.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\javax\servlet\servlet-api\2.5\servlet-api-2.5.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\sun\jersey\jersey-core\1.9\jersey-core-1.9.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-connector-kafka_2.11\1.13.0\flink-connector-kafka_2.11-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\bahir\flink-connector-redis_2.11\1.0\flink-connector-redis_2.11-1.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-streaming-java_2.11\1.2.0\flink-streaming-java_2.11-1.2.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-runtime_2.11\1.2.0\flink-runtime_2.11-1.2.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-shaded-hadoop2\1.2.0\flink-shaded-hadoop2-1.2.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\tukaani\xz\1.0\xz-1.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-el\commons-el\1.0\commons-el-1.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\jamesmurty\utils\java-xmlbuilder\0.4\java-xmlbuilder-0.4.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\jcraft\jsch\0.1.42\jsch-0.1.42.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-beanutils\commons-beanutils-bean-collections\1.8.3\commons-beanutils-bean-collections-1.8.3.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-daemon\commons-daemon\1.0.13\commons-daemon-1.0.13.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\data-artisans\flakka-actor_2.11\2.3-custom\flakka-actor_2.11-2.3-custom.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\data-artisans\flakka-remote_2.11\2.3-custom\flakka-remote_2.11-2.3-custom.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\uncommons\maths\uncommons-maths\1.2.2a\uncommons-maths-1.2.2a.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\data-artisans\flakka-slf4j_2.11\2.3-custom\flakka-slf4j_2.11-2.3-custom.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\clapper\grizzled-slf4j_2.11\1.0.2\grizzled-slf4j_2.11-1.0.2.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\github\scopt\scopt_2.11\3.2.0\scopt_2.11-3.2.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\fasterxml\jackson\core\jackson-core\2.7.4\jackson-core-2.7.4.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\fasterxml\jackson\core\jackson-databind\2.7.4\jackson-databind-2.7.4.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\fasterxml\jackson\core\jackson-annotations\2.7.0\jackson-annotations-2.7.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\twitter\chill_2.11\0.7.4\chill_2.11-0.7.4.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-clients_2.11\1.2.0\flink-clients_2.11-1.2.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-optimizer_2.11\1.2.0\flink-optimizer_2.11-1.2.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\sling\org.apache.sling.commons.json\2.0.6\org.apache.sling.commons.json-2.0.6.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\redis\clients\jedis\2.8.0\jedis-2.8.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\commons\commons-pool2\2.3\commons-pool2-2.3.jar org.wdh01.chapter05.TransformMapTest
MapFunction 内部类> 令狐冲
MapFunction 内部类> 任盈盈
MapFunction 内部类> 依琳

方式三、继承 RichMapFunction (富函数)

大多数转换算子都有富函数的版本,富函数相比基本函数除了能够满足对数据的正常转换之外,还可以获取执行转换算子时的一些上下文信息。

    public static class MyRichMapper extends RichMapFunction<Event, String> {

        @Override
        public String map(Event value) throws Exception {
            return value.user;
        }

        @Override
        public void open(Configuration parameters) throws Exception {
            super.open(parameters);
            System.out.println("---open---" + getRuntimeContext().getIndexOfThisSubtask() + " ");
        }

        @Override
        public void close() throws Exception {
            super.close();
            System.out.println("---close---" + getRuntimeContext().getIndexOfThisSubtask() + " ");
        }
    }

调用富函数形式的map实现需求

     //提取用户 继承 RichMapFunction
        SingleOutputStreamOperator<String> map4 = elementStream.map(new MyRichMapper());
   map4.print("继承RichMapFunction");
E:\Tools\work_tools\jdk1.8\bin\java.exe "-javaagent:D:\tool\IntelliJ IDEA 2020.1\lib\idea_rt.jar=51163:D:\tool\IntelliJ IDEA 2020.1\bin" -Dfile.encoding=UTF-8 -classpath E:\Tools\work_tools\jdk1.8\jre\lib\charsets.jar;E:\Tools\work_tools\jdk1.8\jre\lib\deploy.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\access-bridge-64.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\cldrdata.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\dnsns.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\jaccess.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\jfxrt.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\localedata.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\nashorn.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\sunec.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\sunjce_provider.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\sunmscapi.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\sunpkcs11.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\zipfs.jar;E:\Tools\work_tools\jdk1.8\jre\lib\javaws.jar;E:\Tools\work_tools\jdk1.8\jre\lib\jce.jar;E:\Tools\work_tools\jdk1.8\jre\lib\jfr.jar;E:\Tools\work_tools\jdk1.8\jre\lib\jfxswt.jar;E:\Tools\work_tools\jdk1.8\jre\lib\jsse.jar;E:\Tools\work_tools\jdk1.8\jre\lib\management-agent.jar;E:\Tools\work_tools\jdk1.8\jre\lib\plugin.jar;E:\Tools\work_tools\jdk1.8\jre\lib\resources.jar;E:\Tools\work_tools\jdk1.8\jre\lib\rt.jar;E:\workspace_idea\flink01\target\classes;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-java\1.13.0\flink-java-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-core\1.13.0\flink-core-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-annotations\1.13.0\flink-annotations-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-metrics-core\1.13.0\flink-metrics-core-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-shaded-asm-7\7.1-13.0\flink-shaded-asm-7-7.1-13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\esotericsoftware\kryo\kryo\2.24.0\kryo-2.24.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\esotericsoftware\minlog\minlog\1.2\minlog-1.2.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\objenesis\objenesis\2.1\objenesis-2.1.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\commons\commons-compress\1.20\commons-compress-1.20.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\commons\commons-lang3\3.3.2\commons-lang3-3.3.2.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\commons\commons-math3\3.5\commons-math3-3.5.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\google\code\findbugs\jsr305\1.3.9\jsr305-1.3.9.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\force-shading\1.13.0\force-shading-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-streaming-java_2.12\1.13.0\flink-streaming-java_2.12-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-file-sink-common\1.13.0\flink-file-sink-common-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-runtime_2.12\1.13.0\flink-runtime_2.12-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-queryable-state-client-java\1.13.0\flink-queryable-state-client-java-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-hadoop-fs\1.13.0\flink-hadoop-fs-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-io\commons-io\2.7\commons-io-2.7.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-shaded-netty\4.1.49.Final-13.0\flink-shaded-netty-4.1.49.Final-13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-shaded-jackson\2.12.1-13.0\flink-shaded-jackson-2.12.1-13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-shaded-zookeeper-3\3.4.14-13.0\flink-shaded-zookeeper-3-3.4.14-13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\javassist\javassist\3.24.0-GA\javassist-3.24.0-GA.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\scala-lang\scala-library\2.12.7\scala-library-2.12.7.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\typesafe\akka\akka-actor_2.12\2.5.21\akka-actor_2.12-2.5.21.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\typesafe\config\1.3.3\config-1.3.3.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\scala-lang\modules\scala-java8-compat_2.12\0.8.0\scala-java8-compat_2.12-0.8.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\typesafe\akka\akka-stream_2.12\2.5.21\akka-stream_2.12-2.5.21.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\reactivestreams\reactive-streams\1.0.2\reactive-streams-1.0.2.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\typesafe\ssl-config-core_2.12\0.3.7\ssl-config-core_2.12-0.3.7.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\scala-lang\modules\scala-parser-combinators_2.12\1.1.1\scala-parser-combinators_2.12-1.1.1.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\typesafe\akka\akka-protobuf_2.12\2.5.21\akka-protobuf_2.12-2.5.21.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\typesafe\akka\akka-slf4j_2.12\2.5.21\akka-slf4j_2.12-2.5.21.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\clapper\grizzled-slf4j_2.12\1.3.2\grizzled-slf4j_2.12-1.3.2.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\github\scopt\scopt_2.12\3.5.0\scopt_2.12-3.5.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\xerial\snappy\snappy-java\1.1.8.3\snappy-java-1.1.8.3.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\twitter\chill_2.12\0.7.6\chill_2.12-0.7.6.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\twitter\chill-java\0.7.6\chill-java-0.7.6.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\lz4\lz4-java\1.6.0\lz4-java-1.6.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-shaded-guava\18.0-13.0\flink-shaded-guava-18.0-13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-clients_2.12\1.13.0\flink-clients_2.12-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-optimizer_2.12\1.13.0\flink-optimizer_2.12-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-cli\commons-cli\1.3.1\commons-cli-1.3.1.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-connector-kafka_2.12\1.13.0\flink-connector-kafka_2.12-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\kafka\kafka-clients\2.4.1\kafka-clients-2.4.1.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\github\luben\zstd-jni\1.4.3-1\zstd-jni-1.4.3-1.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-connector-base\1.13.0\flink-connector-base-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\slf4j\slf4j-api\1.7.30\slf4j-api-1.7.30.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\slf4j\slf4j-log4j12\1.7.30\slf4j-log4j12-1.7.30.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\log4j\log4j\1.2.17\log4j-1.2.17.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\logging\log4j\log4j-to-slf4j\2.14.0\log4j-to-slf4j-2.14.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\logging\log4j\log4j-api\2.14.0\log4j-api-2.14.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\xmlenc\xmlenc\0.52\xmlenc-0.52.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-codec\commons-codec\1.4\commons-codec-1.4.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-net\commons-net\3.1\commons-net-3.1.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-logging\commons-logging\1.1.3\commons-logging-1.1.3.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-lang\commons-lang\2.6\commons-lang-2.6.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-configuration\commons-configuration\1.6\commons-configuration-1.6.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-digester\commons-digester\1.8\commons-digester-1.8.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-beanutils\commons-beanutils\1.7.0\commons-beanutils-1.7.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-beanutils\commons-beanutils-core\1.8.0\commons-beanutils-core-1.8.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\codehaus\jackson\jackson-core-asl\1.9.13\jackson-core-asl-1.9.13.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\codehaus\jackson\jackson-mapper-asl\1.9.13\jackson-mapper-asl-1.9.13.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\avro\avro\1.7.4\avro-1.7.4.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\thoughtworks\paranamer\paranamer\2.3\paranamer-2.3.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\google\protobuf\protobuf-java\2.5.0\protobuf-java-2.5.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\zookeeper\zookeeper\3.4.6\zookeeper-3.4.6.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\mortbay\jetty\jetty-util\6.1.26\jetty-util-6.1.26.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\io\netty\netty\3.6.2.Final\netty-3.6.2.Final.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\io\netty\netty-all\4.0.23.Final\netty-all-4.0.23.Final.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\javax\xml\bind\jaxb-api\2.2.2\jaxb-api-2.2.2.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\javax\xml\stream\stax-api\1.0-2\stax-api-1.0-2.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\javax\activation\activation\1.1\activation-1.1.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\javax\servlet\servlet-api\2.5\servlet-api-2.5.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\sun\jersey\jersey-core\1.9\jersey-core-1.9.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-connector-kafka_2.11\1.13.0\flink-connector-kafka_2.11-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\bahir\flink-connector-redis_2.11\1.0\flink-connector-redis_2.11-1.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-streaming-java_2.11\1.2.0\flink-streaming-java_2.11-1.2.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-runtime_2.11\1.2.0\flink-runtime_2.11-1.2.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-shaded-hadoop2\1.2.0\flink-shaded-hadoop2-1.2.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\tukaani\xz\1.0\xz-1.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-el\commons-el\1.0\commons-el-1.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\jamesmurty\utils\java-xmlbuilder\0.4\java-xmlbuilder-0.4.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\jcraft\jsch\0.1.42\jsch-0.1.42.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-beanutils\commons-beanutils-bean-collections\1.8.3\commons-beanutils-bean-collections-1.8.3.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-daemon\commons-daemon\1.0.13\commons-daemon-1.0.13.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\data-artisans\flakka-actor_2.11\2.3-custom\flakka-actor_2.11-2.3-custom.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\data-artisans\flakka-remote_2.11\2.3-custom\flakka-remote_2.11-2.3-custom.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\uncommons\maths\uncommons-maths\1.2.2a\uncommons-maths-1.2.2a.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\data-artisans\flakka-slf4j_2.11\2.3-custom\flakka-slf4j_2.11-2.3-custom.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\clapper\grizzled-slf4j_2.11\1.0.2\grizzled-slf4j_2.11-1.0.2.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\github\scopt\scopt_2.11\3.2.0\scopt_2.11-3.2.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\fasterxml\jackson\core\jackson-core\2.7.4\jackson-core-2.7.4.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\fasterxml\jackson\core\jackson-databind\2.7.4\jackson-databind-2.7.4.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\fasterxml\jackson\core\jackson-annotations\2.7.0\jackson-annotations-2.7.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\twitter\chill_2.11\0.7.4\chill_2.11-0.7.4.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-clients_2.11\1.2.0\flink-clients_2.11-1.2.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-optimizer_2.11\1.2.0\flink-optimizer_2.11-1.2.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\sling\org.apache.sling.commons.json\2.0.6\org.apache.sling.commons.json-2.0.6.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\redis\clients\jedis\2.8.0\jedis-2.8.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\commons\commons-pool2\2.3\commons-pool2-2.3.jar org.wdh01.chapter05.TransformMapTest
---open---0 
继承RichMapFunction> 令狐冲
继承RichMapFunction> 任盈盈
继承RichMapFunction> 依琳
---close---0 

说明:

  1. RicMapFunctionh 版本是抽象类,需要继承(extend),MapFunction 是接口需要实现(implements)。
  2. RicMapFunctionh 除了满足正常的转换,还能获取执行环境的更多的细节信息。 

方式四、lambda 表达式实现转换逻辑

 SingleOutputStreamOperator<String> map3 = elementStream.map(data -> data.user);
 map3.print("lambda 表达式");

结果

E:\Tools\work_tools\jdk1.8\bin\java.exe "-javaagent:D:\tool\IntelliJ IDEA 2020.1\lib\idea_rt.jar=51317:D:\tool\IntelliJ IDEA 2020.1\bin" -Dfile.encoding=UTF-8 -classpath E:\Tools\work_tools\jdk1.8\jre\lib\charsets.jar;E:\Tools\work_tools\jdk1.8\jre\lib\deploy.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\access-bridge-64.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\cldrdata.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\dnsns.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\jaccess.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\jfxrt.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\localedata.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\nashorn.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\sunec.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\sunjce_provider.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\sunmscapi.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\sunpkcs11.jar;E:\Tools\work_tools\jdk1.8\jre\lib\ext\zipfs.jar;E:\Tools\work_tools\jdk1.8\jre\lib\javaws.jar;E:\Tools\work_tools\jdk1.8\jre\lib\jce.jar;E:\Tools\work_tools\jdk1.8\jre\lib\jfr.jar;E:\Tools\work_tools\jdk1.8\jre\lib\jfxswt.jar;E:\Tools\work_tools\jdk1.8\jre\lib\jsse.jar;E:\Tools\work_tools\jdk1.8\jre\lib\management-agent.jar;E:\Tools\work_tools\jdk1.8\jre\lib\plugin.jar;E:\Tools\work_tools\jdk1.8\jre\lib\resources.jar;E:\Tools\work_tools\jdk1.8\jre\lib\rt.jar;E:\workspace_idea\flink01\target\classes;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-java\1.13.0\flink-java-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-core\1.13.0\flink-core-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-annotations\1.13.0\flink-annotations-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-metrics-core\1.13.0\flink-metrics-core-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-shaded-asm-7\7.1-13.0\flink-shaded-asm-7-7.1-13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\esotericsoftware\kryo\kryo\2.24.0\kryo-2.24.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\esotericsoftware\minlog\minlog\1.2\minlog-1.2.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\objenesis\objenesis\2.1\objenesis-2.1.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\commons\commons-compress\1.20\commons-compress-1.20.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\commons\commons-lang3\3.3.2\commons-lang3-3.3.2.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\commons\commons-math3\3.5\commons-math3-3.5.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\google\code\findbugs\jsr305\1.3.9\jsr305-1.3.9.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\force-shading\1.13.0\force-shading-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-streaming-java_2.12\1.13.0\flink-streaming-java_2.12-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-file-sink-common\1.13.0\flink-file-sink-common-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-runtime_2.12\1.13.0\flink-runtime_2.12-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-queryable-state-client-java\1.13.0\flink-queryable-state-client-java-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-hadoop-fs\1.13.0\flink-hadoop-fs-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-io\commons-io\2.7\commons-io-2.7.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-shaded-netty\4.1.49.Final-13.0\flink-shaded-netty-4.1.49.Final-13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-shaded-jackson\2.12.1-13.0\flink-shaded-jackson-2.12.1-13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-shaded-zookeeper-3\3.4.14-13.0\flink-shaded-zookeeper-3-3.4.14-13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\javassist\javassist\3.24.0-GA\javassist-3.24.0-GA.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\scala-lang\scala-library\2.12.7\scala-library-2.12.7.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\typesafe\akka\akka-actor_2.12\2.5.21\akka-actor_2.12-2.5.21.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\typesafe\config\1.3.3\config-1.3.3.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\scala-lang\modules\scala-java8-compat_2.12\0.8.0\scala-java8-compat_2.12-0.8.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\typesafe\akka\akka-stream_2.12\2.5.21\akka-stream_2.12-2.5.21.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\reactivestreams\reactive-streams\1.0.2\reactive-streams-1.0.2.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\typesafe\ssl-config-core_2.12\0.3.7\ssl-config-core_2.12-0.3.7.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\scala-lang\modules\scala-parser-combinators_2.12\1.1.1\scala-parser-combinators_2.12-1.1.1.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\typesafe\akka\akka-protobuf_2.12\2.5.21\akka-protobuf_2.12-2.5.21.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\typesafe\akka\akka-slf4j_2.12\2.5.21\akka-slf4j_2.12-2.5.21.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\clapper\grizzled-slf4j_2.12\1.3.2\grizzled-slf4j_2.12-1.3.2.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\github\scopt\scopt_2.12\3.5.0\scopt_2.12-3.5.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\xerial\snappy\snappy-java\1.1.8.3\snappy-java-1.1.8.3.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\twitter\chill_2.12\0.7.6\chill_2.12-0.7.6.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\twitter\chill-java\0.7.6\chill-java-0.7.6.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\lz4\lz4-java\1.6.0\lz4-java-1.6.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-shaded-guava\18.0-13.0\flink-shaded-guava-18.0-13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-clients_2.12\1.13.0\flink-clients_2.12-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-optimizer_2.12\1.13.0\flink-optimizer_2.12-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-cli\commons-cli\1.3.1\commons-cli-1.3.1.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-connector-kafka_2.12\1.13.0\flink-connector-kafka_2.12-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\kafka\kafka-clients\2.4.1\kafka-clients-2.4.1.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\github\luben\zstd-jni\1.4.3-1\zstd-jni-1.4.3-1.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-connector-base\1.13.0\flink-connector-base-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\slf4j\slf4j-api\1.7.30\slf4j-api-1.7.30.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\slf4j\slf4j-log4j12\1.7.30\slf4j-log4j12-1.7.30.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\log4j\log4j\1.2.17\log4j-1.2.17.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\logging\log4j\log4j-to-slf4j\2.14.0\log4j-to-slf4j-2.14.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\logging\log4j\log4j-api\2.14.0\log4j-api-2.14.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\xmlenc\xmlenc\0.52\xmlenc-0.52.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-codec\commons-codec\1.4\commons-codec-1.4.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-net\commons-net\3.1\commons-net-3.1.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-logging\commons-logging\1.1.3\commons-logging-1.1.3.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-lang\commons-lang\2.6\commons-lang-2.6.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-configuration\commons-configuration\1.6\commons-configuration-1.6.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-digester\commons-digester\1.8\commons-digester-1.8.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-beanutils\commons-beanutils\1.7.0\commons-beanutils-1.7.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-beanutils\commons-beanutils-core\1.8.0\commons-beanutils-core-1.8.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\codehaus\jackson\jackson-core-asl\1.9.13\jackson-core-asl-1.9.13.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\codehaus\jackson\jackson-mapper-asl\1.9.13\jackson-mapper-asl-1.9.13.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\avro\avro\1.7.4\avro-1.7.4.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\thoughtworks\paranamer\paranamer\2.3\paranamer-2.3.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\google\protobuf\protobuf-java\2.5.0\protobuf-java-2.5.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\zookeeper\zookeeper\3.4.6\zookeeper-3.4.6.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\mortbay\jetty\jetty-util\6.1.26\jetty-util-6.1.26.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\io\netty\netty\3.6.2.Final\netty-3.6.2.Final.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\io\netty\netty-all\4.0.23.Final\netty-all-4.0.23.Final.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\javax\xml\bind\jaxb-api\2.2.2\jaxb-api-2.2.2.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\javax\xml\stream\stax-api\1.0-2\stax-api-1.0-2.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\javax\activation\activation\1.1\activation-1.1.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\javax\servlet\servlet-api\2.5\servlet-api-2.5.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\sun\jersey\jersey-core\1.9\jersey-core-1.9.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-connector-kafka_2.11\1.13.0\flink-connector-kafka_2.11-1.13.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\bahir\flink-connector-redis_2.11\1.0\flink-connector-redis_2.11-1.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-streaming-java_2.11\1.2.0\flink-streaming-java_2.11-1.2.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-runtime_2.11\1.2.0\flink-runtime_2.11-1.2.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-shaded-hadoop2\1.2.0\flink-shaded-hadoop2-1.2.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\tukaani\xz\1.0\xz-1.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-el\commons-el\1.0\commons-el-1.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\jamesmurty\utils\java-xmlbuilder\0.4\java-xmlbuilder-0.4.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\jcraft\jsch\0.1.42\jsch-0.1.42.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-beanutils\commons-beanutils-bean-collections\1.8.3\commons-beanutils-bean-collections-1.8.3.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\commons-daemon\commons-daemon\1.0.13\commons-daemon-1.0.13.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\data-artisans\flakka-actor_2.11\2.3-custom\flakka-actor_2.11-2.3-custom.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\data-artisans\flakka-remote_2.11\2.3-custom\flakka-remote_2.11-2.3-custom.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\uncommons\maths\uncommons-maths\1.2.2a\uncommons-maths-1.2.2a.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\data-artisans\flakka-slf4j_2.11\2.3-custom\flakka-slf4j_2.11-2.3-custom.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\clapper\grizzled-slf4j_2.11\1.0.2\grizzled-slf4j_2.11-1.0.2.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\github\scopt\scopt_2.11\3.2.0\scopt_2.11-3.2.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\fasterxml\jackson\core\jackson-core\2.7.4\jackson-core-2.7.4.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\fasterxml\jackson\core\jackson-databind\2.7.4\jackson-databind-2.7.4.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\fasterxml\jackson\core\jackson-annotations\2.7.0\jackson-annotations-2.7.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\com\twitter\chill_2.11\0.7.4\chill_2.11-0.7.4.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-clients_2.11\1.2.0\flink-clients_2.11-1.2.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\flink\flink-optimizer_2.11\1.2.0\flink-optimizer_2.11-1.2.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\sling\org.apache.sling.commons.json\2.0.6\org.apache.sling.commons.json-2.0.6.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\redis\clients\jedis\2.8.0\jedis-2.8.0.jar;E:\Tools\work_tools\apache-maven-3.3.9\repository\org\apache\commons\commons-pool2\2.3\commons-pool2-2.3.jar org.wdh01.chapter05.TransformMapTest
lambda 表达式> 令狐冲
lambda 表达式> 任盈盈
lambda 表达式> 依琳

相比之前的三种形式 lambda 表达式更加的简要,但是需注意jdk1.8 之后才能使用lambda,使用之前 lambda 注意jdk版本。

posted @ 2022-03-22 10:48  晓枫的春天  阅读(521)  评论(0编辑  收藏  举报