KeyedStream继承了DataStream,是由datastream的keyBy(),产生的。表示按key的value分区过的流。在datastream的功能基础上,由添加了一些max,min等聚合的功能。
//1:聚合函数
1:aggregate,通过AggregationFunction实现类,实现各种数据聚合的功能
2:sum,数据累加
3:max,取最大数
4:min,取最小数
//2:分组
keyStream,不允许进行数据分组操作
//3:窗口
和DataStream相比,就是把方法名的后缀,All去掉,其他一样
//4:数据处理
继承自datastream
transform:转变,自定义转换,aggregate也是继承这个。
//5:其他外加
5: reduce:通过一个reduceFunction,配合StreamGroupedReduce(UDF),实现数据reduce
6: fold:知道初始值,和传入一个fold函数,配合StreamGroupedFold(UDF),实现数据fold,
org.apache.flink.streaming.api.datastream.KeyedStream<T, KEY>
org.apache.flink.streaming.api.datastream.KeyedStream.keySelector
org.apache.flink.streaming.api.datastream.KeyedStream.keyType
org.apache.flink.streaming.api.datastream.KeyedStream.KeyedStream(DataStream<T>, KeySelector<T, KEY>)
org.apache.flink.streaming.api.datastream.KeyedStream.KeyedStream(DataStream<T>, KeySelector<T, KEY>, TypeInformation<KEY>)
org.apache.flink.streaming.api.datastream.KeyedStream.getKeySelector()
org.apache.flink.streaming.api.datastream.KeyedStream.getKeyType()
org.apache.flink.streaming.api.datastream.KeyedStream.setConnectionType(StreamPartitioner<T>)
org.apache.flink.streaming.api.datastream.KeyedStream.transform(String, TypeInformation<R>, OneInputStreamOperator<T, R>)
org.apache.flink.streaming.api.datastream.KeyedStream.addSink(SinkFunction<T>)
org.apache.flink.streaming.api.datastream.KeyedStream.timeWindow(Time)
org.apache.flink.streaming.api.datastream.KeyedStream.timeWindow(Time, Time)
org.apache.flink.streaming.api.datastream.KeyedStream.countWindow(long)
org.apache.flink.streaming.api.datastream.KeyedStream.countWindow(long, long)
org.apache.flink.streaming.api.datastream.KeyedStream.window(WindowAssigner<? super T, W>)
org.apache.flink.streaming.api.datastream.KeyedStream.reduce(ReduceFunction<T>)
org.apache.flink.streaming.api.datastream.KeyedStream.fold(R, FoldFunction<T, R>)
org.apache.flink.streaming.api.datastream.KeyedStream.sum(int)
org.apache.flink.streaming.api.datastream.KeyedStream.sum(String)
org.apache.flink.streaming.api.datastream.KeyedStream.min(int)
org.apache.flink.streaming.api.datastream.KeyedStream.min(String)
org.apache.flink.streaming.api.datastream.KeyedStream.max(int)
org.apache.flink.streaming.api.datastream.KeyedStream.max(String)
org.apache.flink.streaming.api.datastream.KeyedStream.minBy(String, boolean)
org.apache.flink.streaming.api.datastream.KeyedStream.maxBy(String, boolean)
org.apache.flink.streaming.api.datastream.KeyedStream.minBy(int)
org.apache.flink.streaming.api.datastream.KeyedStream.minBy(String)
org.apache.flink.streaming.api.datastream.KeyedStream.minBy(int, boolean)
org.apache.flink.streaming.api.datastream.KeyedStream.maxBy(int)
org.apache.flink.streaming.api.datastream.KeyedStream.maxBy(String)
org.apache.flink.streaming.api.datastream.KeyedStream.maxBy(int, boolean)
org.apache.flink.streaming.api.datastream.KeyedStream.aggregate(AggregationFunction<T>)
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.flink.streaming.api.datastream;
import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.annotation.Internal;
import org.apache.flink.annotation.Public;
import org.apache.flink.api.common.functions.FoldFunction;
import org.apache.flink.api.common.functions.ReduceFunction;
import org.apache.flink.api.common.typeinfo.TypeInformation;
imp