当前位置:网站首页>Countwindowall of Flink
Countwindowall of Flink
2022-06-10 05:45:00 【Dragon man who can't fly】
countWindowAll Number window ( No partition number scrolling window 【 The difference between scrolling windows and sliding windows , The reason is that the data elements may overlap in the sliding window , There is no element overlap in the scrolling window 】)
Sample environment
java.version: 1.8.x
flink.version: 1.11.1Sample data source ( Project code cloud download )
Flink System examples And Build development environment and data
CountWindowAll.java
import com.flink.examples.DataSource;
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.api.common.typeinfo.Types;
import org.apache.flink.api.java.tuple.Tuple3;
import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import java.util.List;
/**
* @Description No partition number scrolling window
*/
public class CountWindowAll {
/*
When the window processes stream data , The convection is usually partitioned ;
The data stream is divided into :
keyed( according to key Divide different data flow areas )
non-keyed( I didn't press key Divided data flow area , All raw data streams )
*/
/**
* Ergodic set , Scroll by number window , Returns the sum of ages in the window
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
List<Tuple3<String, String, Integer>> tuple3List = DataSource.getTuple3ToList();
DataStream<Integer> dataStream = env.fromCollection(tuple3List)
.map(new MapFunction<Tuple3<String, String, Integer>, Integer>() {
@Override
public Integer map(Tuple3<String, String, Integer> tuple3) throws Exception {
return tuple3.f2;
}
})
.returns(Types.INT)
// Scroll by number window , Every time 3 Input streams , Calculate once
.countWindowAll(3)
.sum(0);
dataStream.print();
env.execute("flink CountWindowAll job");
}
}
Print the results
1> 70
2> 83边栏推荐
- Blocking problem after the mobile terminal pulls up the keyboard
- Simple and interesting Snake growth game -- greedy snake
- Common English abbreviations of display
- [understanding of opportunity -20]: Guiguzi - reaction chapter - the art of movement and stillness, the combination of speaking and listening, silence is golden
- Curator - node type
- String cutting group by
- General template for one page test plan of Agile Project
- 树莓派4B编译内核模块
- 蚂蚁集团隐私计算一体机获得双认证,83项指标均达要求
- Golang中结构体Struct
猜你喜欢

Top prize! The leading scientific and technological achievement "new technology" of 2022 digital Expo was awarded to oceanbase database

MySQL uses where in under the InnoDB engine to cause lock escalation

Harbor cannot log in with the correct password

Power mathematics of leetcode326-3

The first BMW I brand exclusive experience store was opened to fully demonstrate the charm of BMW electric products

数字化浪潮来临,如何实现业务敏捷交付和科技持续治理?揭秘蚂蚁 BizStack

Apm飞控学习笔记之悬停loiter模式-Cxm

In terms of emotional perception, the financial assistant robot "zhixiaobao" goes further

QT中对Mat类的一些操作

Flutter file operation
随机推荐
Five best! Ant group passed the highest level evaluation of the "stability Assurance Plan" of the ICT Institute
matlab中不同随机数的生成
MYSQL第一篇(基础知识)
Be diligent in making money abroad and talk about the importance of tasks
图片识字的教程
The process of data division with R language's catools package, random forest model construction with randomforest package, and visualization of the trained random forest model with plot function (the
Hevc HM learning 01
JUC realize future
最高奖项!2022数博会领先科技成果“新技术”授予OceanBase数据库
BFS practice topic
The R language uses the matchit package for propensity matching analysis and match The data function constructs the matched sample set, and judges the balance of all covariates in the sample after pro
Installation and configuration of NPM and yarn
Curator - node type
How to ensure system stability and achieve emission reduction? Ant group has these key technologies
浏览器安装这款插件瞬间漂亮多了,有类似苹果手机一样的自定义组件功能
Sequential search, binary search
Safari's favorites item does not appear on the home page
Crash使用
MySQL Part 1 (basic knowledge)
[homeassistant drive servo]