operator
作用流的轉換
map將乙個元素轉換成另外乙個元素
datastream → datastream本
flapmap
將幾個的乙個元素轉換為零個,乙個或者多個
datastream → datastream
filter
保留集合中返回true的元素
datastream → datastream
keyby
對資料流進行邏輯分割槽,相同的key在同一分割槽
datastream → keyedstream
reduce
遍歷集合,依次合併元素最終生產乙個元素
keyedstream → datastream
fold
遍歷結合從第乙個元素到最後乙個元素依次連線起來
keyedstream → datastream
aggregations
emmmm
keyedstream → datastream
window
基於已經分割槽的stream,將元素劃分視窗
keyedstream → windowedstream
windowall
基於未分割槽的stream,將所有元素集中到乙個task
datastream → allwindowedstream
自定義函式處理視窗內所有的元素
windowedstream → datastream allwindowedstream → datastream
window reduce
視窗內所有元素reduce到乙個結果
windowedstream → datastream
window fold
同stream的fold
windowedstream → datastream
aggregations on windows
同stream的aggregations
windowedstream → datastream
union
將兩個流合併
datastream* → datastream
window join
兩個流join成乙個流,指定分割槽key,在指定window,視窗是必須的
datastream,datastream → datastream
interval join
流2 join 流1中一段時間的元素
keyedstream,keyedstream → datastream
window cogroup
雙流join,指定視窗
datastream,datastream → datastream
connect
聯合兩個流,保留各種state
datastream,datastream → connectedstreams
comap, coflatmap
同map, coflatmap
connectedstreams → datastream
split
流拆分datastream → splitstream
select
從splitstream分離出datastream
splitstream → datastream
iterate
-datastream → iterativestream → datastream--
-extract timestamps
設定event time
datastream → datastream
datastreamdatastream = //...
datastream.map(new mapfunction()
});
datastream.flatmap(new flatmapfunction()
}});
datastream.filter(new filterfunction()
});
datastream.keyby("somekey") // key by field "somekey"
datastream.keyby(0) // key by the first element of a tuple
keyedstream.reduce(new reducefunction()
});
datastreamresult =
keyedstream.fold("start", new foldfunction()
});
keyedstream.sum(0);
keyedstream.sum("key");
keyedstream.min(0);
keyedstream.min("key");
keyedstream.max(0);
keyedstream.max("key");
keyedstream.minby(0);
keyedstream.minby("key");
keyedstream.maxby(0);
keyedstream.maxby("key");
datastream.join(otherstream)
.where().equalto()
.window(tumblingeventtimewindows.of(time.seconds(3)))
// this will join the two streams so that
// key1 == key2 && leftts - 2 < rightts < leftts + 2
keyedstream.intervaljoin(otherkeyedstream)
.between(time.milliseconds(-2), time.milliseconds(2)) // lower and upper bound
.upperboundexclusive(true) // optional
.lowerboundexclusive(true) // optional
.process(new intervaljoinfunction() );
splitstreamsplit = somedatastream.split(new outputselector()
else
return output;
}});
flink運算元(四)
table 的建立方式 dataset 和datastream 隱式轉化 case class sink table source table externalcatalog table table api 用法 val orders tableenv.scan orders val revenue...
operator運算元 隱式型別轉換
3.參考資料 對於 operator 運算子,除了常用的operator overloading 操作符過載 之外,還有operator casting 操作隱式轉換 的用法。c 可以通過operator實現過載操作符,格式如下 return type operator operand parame...
Flink學習筆記(六) flink的運算元與富函式
一 flink中的的transformation運算元 flink常用運算元就不自己詳細記錄了,看這裡就夠了。二 富函式 在呼叫datastream的運算元例如map filter時,可以傳入乙個函式,也可以傳入乙個function類,就像這樣 val filterstream stream.fil...